explain.depesz.com

PostgreSQL's explain analyze made readable

Result: AJo5

Settings
# exclusive inclusive rows x rows loops node
1. 0.943 454.709 ↓ 54.9 384 1

Append (cost=0.00..748.08 rows=7 width=640) (actual time=0.030..454.709 rows=384 loops=1)

2. 0.029 0.029 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=640) (actual time=0.026..0.029 rows=1 loops=1)

3. 0.041 0.556 ↑ 1.0 1 1

Nested Loop (cost=4.68..79.86 rows=1 width=640) (actual time=0.468..0.556 rows=1 loops=1)

4. 0.136 0.292 ↑ 4.0 1 1

Hash Join (cost=4.40..6.37 rows=4 width=43) (actual time=0.209..0.292 rows=1 loops=1)

  • Hash Cond: (a.segfilcod = b.segfilcod)
5. 0.115 0.115 ↑ 1.0 76 1

Seq Scan on segmentacao_filtro a (cost=0.00..1.76 rows=76 width=27) (actual time=0.016..0.115 rows=76 loops=1)

6. 0.011 0.041 ↑ 4.0 1 1

Hash (cost=4.35..4.35 rows=4 width=16) (actual time=0.040..0.041 rows=1 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
7. 0.030 0.030 ↑ 4.0 1 1

Index Only Scan using segmentacaolevel1_pkey on segmentacaolevel1 b (cost=0.28..4.35 rows=4 width=16) (actual time=0.027..0.030 rows=1 loops=1)

  • Index Cond: (segcod = 1,901)
  • Heap Fetches: 0
8. 0.024 0.024 ↑ 1.0 1 1

Index Scan using segmentacaolevel1level2_pkey on segmentacaolevel1level2 c (cost=0.29..6.15 rows=1 width=81) (actual time=0.021..0.024 rows=1 loops=1)

  • Index Cond: ((segcod = 1,901) AND (segfilcod = a.segfilcod))
9.          

SubPlan (for Nested Loop)

10. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=23.76..23.77 rows=1 width=32) (never executed)

11.          

Initplan (for Aggregate)

12. 0.000 0.000 ↓ 0.0 0

Index Scan using segmentacaolevel1level2_pkey on segmentacaolevel1level2 sl (cost=0.29..15.46 rows=3 width=8) (never executed)

  • Index Cond: ((segcod = c.segcod) AND (segfilcod = 48))
13. 0.000 0.000 ↓ 0.0 0

Index Scan using carteira_situacao_pkey on carteira_situacao x (cost=0.28..8.30 rows=1 width=20) (never executed)

  • Index Cond: ((carcod = $1) AND (sitcod = c.segfili01))
14. 0.000 0.000 ↓ 0.0 0

Seq Scan on produto x_1 (cost=0.00..1.59 rows=1 width=32) (never executed)

  • Filter: (procod = c.segfili01)
15. 0.000 0.000 ↓ 0.0 0

Index Scan using usuario_pkey on usuario u (cost=0.28..8.30 rows=1 width=25) (never executed)

  • Index Cond: (usucod = c.segfili01)
16. 0.000 0.000 ↓ 0.0 0

Index Scan using usuario_pkey on usuario u_1 (cost=0.28..8.30 rows=1 width=25) (never executed)

  • Index Cond: (usucod = c.segfili01)
17. 0.000 0.000 ↓ 0.0 0

Seq Scan on endereco_tipo x_2 (cost=0.00..1.15 rows=1 width=32) (never executed)

  • Filter: (tipendcod = c.segfili01)
18. 0.000 0.000 ↓ 0.0 0

Seq Scan on pessoa_tipo x_3 (cost=0.00..1.06 rows=1 width=32) (never executed)

  • Filter: (tippescod = c.segfili01)
19. 0.199 0.199 ↑ 1.0 1 1

Seq Scan on carteira x_4 (cost=0.00..4.30 rows=1 width=17) (actual time=0.016..0.199 rows=1 loops=1)

  • Filter: (carcod = c.segfili01)
  • Rows Removed by Filter: 23
20. 0.005 0.005 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=640) (actual time=0.003..0.005 rows=1 loops=1)

21. 0.005 0.005 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=640) (actual time=0.003..0.005 rows=1 loops=1)

22. 1.101 453.171 ↓ 126.7 380 1

Subquery Scan on *SELECT* 5 (cost=378.95..668.11 rows=3 width=640) (actual time=151.201..453.171 rows=380 loops=1)

23. 1.055 452.070 ↓ 126.7 380 1

Subquery Scan on x1 (cost=378.95..668.08 rows=3 width=640) (actual time=151.195..452.070 rows=380 loops=1)

24. 171.653 451.015 ↓ 126.7 380 1

Group (cost=378.95..668.05 rows=3 width=1,590) (actual time=151.191..451.015 rows=380 loops=1)

  • Group Key: (((SubPlan 18))::character varying), ((a_1.devcod)::character varying), ((a_1.devcpf)::character varying), a_1.devnom, ((a_1.devsal)::character varying), e.sitnom, (((SubPlan 19))::character varying), (((SubPlan 20))::character varying), ((SubPlan 21)), ((t.telseq)::character varying), ((t.tiptelcod)::character varying), ((t.pescod)::character varying), t.telsomnum, ((t.telsit)::character varying), ((CASE WHEN (t.telclas = 1) THEN 1- HOT::text WHEN (t.telclas = 2) THEN 2- PREFERENCIAL::text WHEN (t.telclas = 3) THEN 3- RECADO::text WHEN (t.telclas = 4) THEN 4- INCORRETO::text WHEN (t.telclas = 5) THEN 5- BLOQUEADO::text WHEN (t.telclas = 6) THEN 6- EXCLUIR::text WHEN (t.telclas = 7) THEN 7- INEXISTENTE::text WHEN (t.telclas = 0) THEN NAO CLASSIFICADO::text ELSE NULL::text END)::character varying), ((SubPlan 22)), ((SubPlan 23)), ((SubPlan 24)), ((SubPlan 25)), ((SubPlan 26))
25. 3.491 149.402 ↓ 126.7 380 1

Sort (cost=378.95..378.95 rows=3 width=999) (actual time=148.844..149.402 rows=380 loops=1)

  • Sort Key: (((SubPlan 18))::character varying), ((a_1.devcod)::character varying), ((a_1.devcpf)::character varying), a_1.devnom, ((a_1.devsal)::character varying), e.sitnom, (((SubPlan 19))::character varying), (((SubPlan 20))::character varying), ((SubPlan 21)), ((t.telseq)::character varying), ((t.tiptelcod)::character varying), ((t.pescod)::character varying), t.telsomnum, ((t.telsit)::character varying), ((CASE WHEN (t.telclas = 1) THEN 1- HOT::text WHEN (t.telclas = 2) THEN 2- PREFERENCIAL::text WHEN (t.telclas = 3) THEN 3- RECADO::text WHEN (t.telclas = 4) THEN 4- INCORRETO::text WHEN (t.telclas = 5) THEN 5- BLOQUEADO::text WHEN (t.telclas = 6) THEN 6- EXCLUIR::text WHEN (t.telclas = 7) THEN 7- INEXISTENTE::text WHEN (t.telclas = 0) THEN NAO CLASSIFICADO::text ELSE NULL::text END)::character varying), ((SubPlan 22)), ((SubPlan 23)), ((SubPlan 24)), ((SubPlan 25)), ((SubPlan 26))
  • Sort Method: quicksort Memory: 185kB
26. 12.235 145.911 ↓ 126.7 380 1

Nested Loop (cost=4.89..378.92 rows=3 width=999) (actual time=1.462..145.911 rows=380 loops=1)

27. 0.944 5.276 ↓ 100.0 300 1

Nested Loop (cost=4.46..240.19 rows=3 width=69) (actual time=0.577..5.276 rows=300 loops=1)

28. 0.276 3.232 ↓ 50.0 50 1

Nested Loop (cost=3.90..239.54 rows=1 width=89) (actual time=0.544..3.232 rows=50 loops=1)

29. 0.709 2.656 ↓ 50.0 50 1

Nested Loop (cost=3.63..239.24 rows=1 width=67) (actual time=0.519..2.656 rows=50 loops=1)

30. 0.216 1.697 ↓ 50.0 50 1

Nested Loop Semi Join (cost=3.49..239.08 rows=1 width=63) (actual time=0.489..1.697 rows=50 loops=1)

  • Join Filter: (a_1.carcod = c_1.segfili01)
31. 0.295 1.381 ↑ 1.0 50 1

Nested Loop (cost=3.20..230.03 rows=50 width=55) (actual time=0.462..1.381 rows=50 loops=1)

32. 0.195 0.536 ↑ 1.0 50 1

HashAggregate (cost=2.78..3.28 rows=50 width=8) (actual time=0.435..0.536 rows=50 loops=1)

  • Group Key: devedor.devcod
33. 0.141 0.341 ↑ 1.0 50 1

Limit (cost=0.43..2.15 rows=50 width=8) (actual time=0.033..0.341 rows=50 loops=1)

34. 0.200 0.200 ↑ 209.8 50 1

Index Only Scan using devedor_pkey on devedor (cost=0.43..361.81 rows=10,488 width=8) (actual time=0.030..0.200 rows=50 loops=1)

  • Index Cond: (carcod = 208)
  • Heap Fetches: 13
35. 0.550 0.550 ↑ 1.0 1 50

Index Only Scan using devedor_i5 on devedor a_1 (cost=0.43..4.53 rows=1 width=47) (actual time=0.009..0.011 rows=1 loops=50)

  • Index Cond: (devcod = devedor.devcod)
  • Heap Fetches: 13
36. 0.087 0.100 ↑ 1.0 1 50

Materialize (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=50)

37. 0.013 0.013 ↑ 1.0 1 1

Index Scan using segmentacaolevel1level2_pkey on segmentacaolevel1level2 c_1 (cost=0.29..8.30 rows=1 width=8) (actual time=0.012..0.013 rows=1 loops=1)

  • Index Cond: ((segcod = 1,901) AND (segfilcod = 48))
38. 0.250 0.250 ↑ 1.0 1 50

Index Only Scan using carteira_pkey on carteira g (cost=0.14..0.16 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=50)

  • Index Cond: (carcod = a_1.carcod)
  • Heap Fetches: 50
39. 0.300 0.300 ↑ 1.0 1 50

Index Scan using carteira_situacao_pkey on carteira_situacao e (cost=0.28..0.30 rows=1 width=26) (actual time=0.006..0.006 rows=1 loops=50)

  • Index Cond: ((carcod = a_1.carcod) AND (sitcod = a_1.devsitcod))
40. 1.100 1.100 ↓ 6.0 6 50

Index Only Scan using pessoa_iu0002 on pessoa p (cost=0.56..0.64 rows=1 width=20) (actual time=0.010..0.022 rows=6 loops=50)

  • Index Cond: ((carcod = a_1.carcod) AND (devcod = a_1.devcod))
  • Heap Fetches: 65
41. 3.000 3.000 ↑ 3.0 1 300

Index Scan using telefone_iu0002 on telefone t (cost=0.43..0.58 rows=3 width=30) (actual time=0.007..0.010 rows=1 loops=300)

  • Index Cond: (pescod = p.pescod)
42.          

SubPlan (for Nested Loop)

43. 1.520 4.560 ↑ 1.0 1 380

Limit (cost=0.43..6.36 rows=1 width=32) (actual time=0.011..0.012 rows=1 loops=380)

44. 3.040 3.040 ↑ 2.0 1 380

Index Scan using telefone_iu0005 on telefone t1_3 (cost=0.43..12.29 rows=2 width=32) (actual time=0.008..0.008 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tiptelcod = 1))
45. 1.520 3.800 ↑ 1.0 1 380

Limit (cost=0.43..8.45 rows=1 width=32) (actual time=0.009..0.010 rows=1 loops=380)

46. 2.280 2.280 ↑ 1.0 1 380

Index Scan using telefone_iu0005 on telefone t1_4 (cost=0.43..8.45 rows=1 width=32) (actual time=0.006..0.006 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tiptelcod = 3))
47. 1.140 95.000 ↓ 0.0 0 380

Limit (cost=0.43..6.83 rows=1 width=32) (actual time=0.250..0.250 rows=0 loops=380)

48. 93.860 93.860 ↓ 0.0 0 380

Index Scan using itelefone1 on telefone t1_5 (cost=0.43..6.83 rows=1 width=32) (actual time=0.247..0.247 rows=0 loops=380)

  • Index Cond: (tiptelcod = 8)
  • Filter: (pescod = p.pescod)
  • Rows Removed by Filter: 233
49. 1.900 1.900 ↑ 1.0 1 380

Seq Scan on status_registro status_registro_1 (cost=0.00..1.09 rows=1 width=15) (actual time=0.003..0.005 rows=1 loops=380)

  • Filter: (stacod = t.telsit)
  • Rows Removed by Filter: 6
50. 1.520 4.940 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=10) (actual time=0.012..0.013 rows=1 loops=380)

51. 3.420 3.420 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_5 (cost=0.56..517.40 rows=129 width=10) (actual time=0.009..0.009 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
52. 1.520 3.800 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=8) (actual time=0.009..0.010 rows=1 loops=380)

53. 2.280 2.280 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_6 (cost=0.56..517.40 rows=129 width=8) (actual time=0.006..0.006 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
54. 1.140 3.800 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=29) (actual time=0.010..0.010 rows=1 loops=380)

55. 2.660 2.660 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_7 (cost=0.56..517.40 rows=129 width=29) (actual time=0.007..0.007 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
56. 1.520 3.800 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=3) (actual time=0.009..0.010 rows=1 loops=380)

57. 2.280 2.280 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_8 (cost=0.56..517.40 rows=129 width=3) (actual time=0.006..0.006 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
58. 1.520 3.800 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=10) (actual time=0.009..0.010 rows=1 loops=380)

59. 2.280 2.280 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_9 (cost=0.56..517.40 rows=129 width=10) (actual time=0.006..0.006 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
60.          

SubPlan (for Group)

61. 1.900 5.320 ↑ 1.0 1 380

Limit (cost=0.43..6.36 rows=1 width=32) (actual time=0.012..0.014 rows=1 loops=380)

62. 3.420 3.420 ↑ 2.0 1 380

Index Scan using telefone_iu0005 on telefone t1 (cost=0.43..12.29 rows=2 width=32) (actual time=0.009..0.009 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tiptelcod = 1))
63. 1.520 4.180 ↑ 1.0 1 380

Limit (cost=0.43..8.45 rows=1 width=32) (actual time=0.011..0.011 rows=1 loops=380)

64. 2.660 2.660 ↑ 1.0 1 380

Index Scan using telefone_iu0005 on telefone t1_1 (cost=0.43..8.45 rows=1 width=32) (actual time=0.007..0.007 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tiptelcod = 3))
65. 1.140 95.000 ↓ 0.0 0 380

Limit (cost=0.43..6.83 rows=1 width=32) (actual time=0.250..0.250 rows=0 loops=380)

66. 93.860 93.860 ↓ 0.0 0 380

Index Scan using itelefone1 on telefone t1_2 (cost=0.43..6.83 rows=1 width=32) (actual time=0.247..0.247 rows=0 loops=380)

  • Index Cond: (tiptelcod = 8)
  • Filter: (pescod = p.pescod)
  • Rows Removed by Filter: 233
67. 1.900 1.900 ↑ 1.0 1 380

Seq Scan on status_registro (cost=0.00..1.09 rows=1 width=15) (actual time=0.004..0.005 rows=1 loops=380)

  • Filter: (stacod = t.telsit)
  • Rows Removed by Filter: 6
68. 1.520 5.320 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=10) (actual time=0.014..0.014 rows=1 loops=380)

69. 3.800 3.800 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k (cost=0.56..517.40 rows=129 width=10) (actual time=0.010..0.010 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
70. 1.520 4.180 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=8) (actual time=0.010..0.011 rows=1 loops=380)

71. 2.660 2.660 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_1 (cost=0.56..517.40 rows=129 width=8) (actual time=0.007..0.007 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
72. 3.420 6.080 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=29) (actual time=0.015..0.016 rows=1 loops=380)

73. 2.660 2.660 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_2 (cost=0.56..517.40 rows=129 width=29) (actual time=0.007..0.007 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
74. 1.140 3.800 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=3) (actual time=0.010..0.010 rows=1 loops=380)

75. 2.660 2.660 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_3 (cost=0.56..517.40 rows=129 width=3) (actual time=0.007..0.007 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
76. 1.520 4.180 ↑ 1.0 1 380

Limit (cost=0.56..4.57 rows=1 width=10) (actual time=0.010..0.011 rows=1 loops=380)

77. 2.660 2.660 ↑ 129.0 1 380

Index Scan using endereco_iu0006 on endereco k_4 (cost=0.56..517.40 rows=129 width=10) (actual time=0.007..0.007 rows=1 loops=380)

  • Index Cond: ((pescod = p.pescod) AND (tipendcod = 1))
Planning time : 28.358 ms
Execution time : 456.329 ms