explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JJ8q

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 136.545 ↑ 1.0 50 1

Limit (cost=20,646.43..20,646.70 rows=50 width=582) (actual time=136.526..136.545 rows=50 loops=1)

2. 0.014 136.542 ↑ 4.0 50 1

Unique (cost=20,646.43..20,647.50 rows=200 width=582) (actual time=136.525..136.542 rows=50 loops=1)

3. 0.596 136.528 ↑ 4.3 50 1

Sort (cost=20,646.43..20,646.97 rows=214 width=582) (actual time=136.523..136.528 rows=50 loops=1)

  • Sort Key: "*SELECT* 1".codigo
  • Sort Method: quicksort Memory: 188kB
4. 0.466 135.932 ↓ 2.9 610 1

Nested Loop Left Join (cost=439.40..20,638.15 rows=214 width=582) (actual time=1.243..135.932 rows=610 loops=1)

5. 0.441 133.636 ↓ 2.9 610 1

Nested Loop Left Join (cost=438.97..18,873.31 rows=214 width=573) (actual time=1.236..133.636 rows=610 loops=1)

6. 0.712 133.195 ↓ 2.9 610 1

Nested Loop Left Join (cost=438.83..18,791.31 rows=214 width=455) (actual time=1.235..133.195 rows=610 loops=1)

7. 0.087 131.873 ↓ 2.9 610 1

Append (cost=438.69..18,741.69 rows=214 width=446) (actual time=1.231..131.873 rows=610 loops=1)

8. 0.193 131.421 ↓ 10.0 610 1

Subquery Scan on *SELECT* 1 (cost=438.69..17,003.25 rows=61 width=446) (actual time=1.231..131.421 rows=610 loops=1)

9. 7.962 131.228 ↓ 10.0 610 1

Nested Loop (cost=438.69..17,002.64 rows=61 width=538) (actual time=1.230..131.228 rows=610 loops=1)

10. 0.384 121.436 ↓ 10.0 610 1

Hash Left Join (cost=438.27..16,476.40 rows=61 width=434) (actual time=1.034..121.436 rows=610 loops=1)

  • Hash Cond: ("*SELECT* 1_1".tipodocumento_codigo = t_1.codigo)
11. 0.419 121.035 ↓ 10.0 610 1

Nested Loop Left Join (cost=436.79..16,474.75 rows=61 width=356) (actual time=0.968..121.035 rows=610 loops=1)

12. 0.302 120.616 ↓ 10.0 610 1

Nested Loop Left Join (cost=436.65..16,420.69 rows=61 width=238) (actual time=0.967..120.616 rows=610 loops=1)

13. 0.368 119.704 ↓ 10.0 610 1

Nested Loop Left Join (cost=436.50..16,410.62 rows=61 width=117) (actual time=0.964..119.704 rows=610 loops=1)

14. 0.376 117.506 ↓ 10.0 610 1

Nested Loop Left Join (cost=436.07..15,895.62 rows=61 width=113) (actual time=0.959..117.506 rows=610 loops=1)

  • Join Filter: (c.codigo = "*SELECT* 1_1".clientes_codigo)
15. 0.534 117.130 ↓ 10.0 610 1

Nested Loop (cost=435.79..15,886.40 rows=61 width=87) (actual time=0.950..117.130 rows=610 loops=1)

16. 0.065 114.766 ↓ 10.0 610 1

Append (cost=435.36..15,371.26 rows=61 width=87) (actual time=0.937..114.766 rows=610 loops=1)

17. 0.129 114.701 ↓ 10.0 610 1

Subquery Scan on *SELECT* 1_1 (cost=435.36..15,370.95 rows=61 width=87) (actual time=0.937..114.701 rows=610 loops=1)

18. 0.632 114.572 ↓ 10.0 610 1

Nested Loop (cost=435.36..15,370.34 rows=61 width=168) (actual time=0.937..114.572 rows=610 loops=1)

19. 61.518 112.110 ↓ 10.0 610 1

Hash Join (cost=434.94..15,339.51 rows=61 width=12) (actual time=0.930..112.110 rows=610 loops=1)

  • Hash Cond: (pvpg_cr.prevendas_pagtos_codigo = pvpg.codigo)
20. 49.922 49.922 ↑ 1.0 819,997 1

Seq Scan on prevendas_pagtos_contasareceber pvpg_cr (cost=0.00..11,828.97 rows=819,997 width=8) (actual time=0.012..49.922 rows=819,997 loops=1)

21. 0.035 0.670 ↓ 4.2 160 1

Hash (cost=434.46..434.46 rows=38 width=12) (actual time=0.670..0.670 rows=160 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
22. 0.063 0.635 ↓ 4.2 160 1

Nested Loop (cost=0.84..434.46 rows=38 width=12) (actual time=0.020..0.635 rows=160 loops=1)

23. 0.113 0.113 ↓ 4.2 153 1

Index Scan using prevendas_codcliente_unique on prevendas pv_1 (cost=0.42..130.17 rows=36 width=8) (actual time=0.011..0.113 rows=153 loops=1)

  • Index Cond: (codcliente = 55)
24. 0.459 0.459 ↑ 1.0 1 153

Index Scan using prevenda_pagto_codprevenda_codfinalizadora_unique on prevenda_pagto pvpg (cost=0.42..8.44 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=153)

  • Index Cond: ((codprevenda = pv_1.codigo) AND (codprevenda IS NOT NULL))
25. 1.830 1.830 ↑ 1.0 1 610

Index Scan using contasareceber_pkey1 on contasareceber cr (cost=0.42..0.51 rows=1 width=35) (actual time=0.003..0.003 rows=1 loops=610)

  • Index Cond: (codigo = pvpg_cr.contasareceber_codigo)
26. 1.830 1.830 ↑ 1.0 1 610

Index Only Scan using contasareceber_faturamentos_pkey on contasareceber_faturamentos cr_fat (cost=0.42..8.45 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=610)

  • Index Cond: ((contasareceber_codigo = "*SELECT* 1_1".codigo) AND (contasareceber_codigo IS NOT NULL))
  • Heap Fetches: 610
27. 0.000 0.000 ↑ 1.0 1 610

Materialize (cost=0.29..8.31 rows=1 width=30) (actual time=0.000..0.000 rows=1 loops=610)

28. 0.004 0.004 ↑ 1.0 1 1

Index Scan using unq_clientes on clientes c (cost=0.29..8.30 rows=1 width=30) (actual time=0.004..0.004 rows=1 loops=1)

  • Index Cond: (codigo = 55)
29. 1.830 1.830 ↑ 1.0 1 610

Index Scan using contasareceber_situacao_pkey on contasareceber_situacao cr_sit (cost=0.42..8.44 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=610)

  • Index Cond: ("*SELECT* 1_1".codigo = contasareceber_codigo)
30. 0.610 0.610 ↑ 1.0 1 610

Index Scan using situacoescontas_pkey on situacoescontas sc (cost=0.15..0.17 rows=1 width=125) (actual time=0.001..0.001 rows=1 loops=610)

  • Index Cond: (cr_sit.situacoesconta_codigo = codigo)
31. 0.000 0.000 ↓ 0.0 0 610

Index Scan using gruposcontas_pkey on gruposcontas grct (cost=0.15..0.89 rows=1 width=122) (actual time=0.000..0.000 rows=0 loops=610)

  • Index Cond: (codigo = "*SELECT* 1_1".gruposcontas_codigo)
32. 0.007 0.017 ↓ 1.0 22 1

Hash (cost=1.21..1.21 rows=21 width=82) (actual time=0.017..0.017 rows=22 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
33. 0.010 0.010 ↓ 1.0 22 1

Seq Scan on tipodocumento t_1 (cost=0.00..1.21 rows=21 width=82) (actual time=0.008..0.010 rows=22 loops=1)

34. 1.830 1.830 ↑ 1.0 1 610

Index Scan using prevendas_codigo_index on prevendas pv (cost=0.42..8.37 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=610)

  • Index Cond: (codigo = "*SELECT* 1_1".prevendas_codigo)
35. 0.000 0.338 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2 (cost=1,243.50..1,333.21 rows=1 width=446) (actual time=0.338..0.338 rows=0 loops=1)

36. 0.000 0.338 ↓ 0.0 0 1

Nested Loop (cost=1,243.50..1,333.20 rows=1 width=538) (actual time=0.338..0.338 rows=0 loops=1)

37. 0.001 0.338 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,243.08..1,324.51 rows=1 width=434) (actual time=0.338..0.338 rows=0 loops=1)

  • Join Filter: (t_2.codigo = "*SELECT* 2_1".tipodocumento_codigo)
38. 0.000 0.337 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,243.08..1,323.03 rows=1 width=356) (actual time=0.337..0.337 rows=0 loops=1)

39. 0.000 0.337 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,242.93..1,314.83 rows=1 width=238) (actual time=0.337..0.337 rows=0 loops=1)

40. 0.000 0.337 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,242.78..1,314.67 rows=1 width=117) (actual time=0.337..0.337 rows=0 loops=1)

41. 0.000 0.337 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,242.36..1,306.23 rows=1 width=113) (actual time=0.337..0.337 rows=0 loops=1)

  • Join Filter: (c_1.codigo = "*SELECT* 2_1".clientes_codigo)
42. 0.001 0.337 ↓ 0.0 0 1

Nested Loop (cost=1,242.07..1,297.91 rows=1 width=87) (actual time=0.337..0.337 rows=0 loops=1)

43. 0.000 0.336 ↓ 0.0 0 1

Append (cost=1,241.65..1,289.47 rows=1 width=87) (actual time=0.336..0.336 rows=0 loops=1)

44. 0.001 0.336 ↓ 0.0 0 1

Subquery Scan on *SELECT* 2_1 (cost=1,241.65..1,289.46 rows=1 width=87) (actual time=0.336..0.336 rows=0 loops=1)

45. 0.000 0.335 ↓ 0.0 0 1

Nested Loop (cost=1,241.65..1,289.45 rows=1 width=168) (actual time=0.335..0.335 rows=0 loops=1)

46. 0.011 0.335 ↓ 0.0 0 1

Hash Join (cost=1,241.22..1,282.31 rows=1 width=12) (actual time=0.335..0.335 rows=0 loops=1)

  • Hash Cond: (snfpg_cr.saidasnf_pagtos_codigo = snfpg.codigo)
47. 0.018 0.018 ↑ 64.6 35 1

Seq Scan on saidasnf_pagtos_contasareceber snfpg_cr (cost=0.00..32.60 rows=2,260 width=8) (actual time=0.016..0.018 rows=35 loops=1)

48. 0.022 0.306 ↑ 1.7 63 1

Hash (cost=1,239.87..1,239.87 rows=108 width=12) (actual time=0.306..0.306 rows=63 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
49. 0.035 0.284 ↑ 1.7 63 1

Nested Loop (cost=5.65..1,239.87 rows=108 width=12) (actual time=0.030..0.284 rows=63 loops=1)

50. 0.054 0.069 ↑ 1.7 60 1

Bitmap Heap Scan on saidasnf snf_1 (cost=5.23..392.81 rows=104 width=8) (actual time=0.023..0.069 rows=60 loops=1)

  • Recheck Cond: (codcliente = 55)
  • Heap Blocks: exact=60
51. 0.015 0.015 ↑ 1.7 60 1

Bitmap Index Scan on saidasnf_codcliente_index (cost=0.00..5.20 rows=104 width=0) (actual time=0.015..0.015 rows=60 loops=1)

  • Index Cond: (codcliente = 55)
52. 0.180 0.180 ↑ 1.0 1 60

Index Scan using saidasnf_pagto_codsaidasnf_codformapagtofinalizadora_idx on saidasnf_pagto snfpg (cost=0.42..8.13 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=60)

  • Index Cond: ((codsaidasnf = snf_1.codigo) AND (codsaidasnf IS NOT NULL))
53. 0.000 0.000 ↓ 0.0 0

Index Scan using contasareceber_pkey1 on contasareceber cr_1 (cost=0.42..7.15 rows=1 width=35) (never executed)

  • Index Cond: (codigo = snfpg_cr.contasareceber_codigo)
54. 0.000 0.000 ↓ 0.0 0

Index Only Scan using contasareceber_faturamentos_pkey on contasareceber_faturamentos cr_fat_1 (cost=0.42..8.45 rows=1 width=4) (never executed)

  • Index Cond: ((contasareceber_codigo = "*SELECT* 2_1".codigo) AND (contasareceber_codigo IS NOT NULL))
  • Heap Fetches: 0
55. 0.000 0.000 ↓ 0.0 0

Index Scan using unq_clientes on clientes c_1 (cost=0.29..8.30 rows=1 width=30) (never executed)

  • Index Cond: (codigo = 55)
56. 0.000 0.000 ↓ 0.0 0

Index Scan using contasareceber_situacao_pkey on contasareceber_situacao cr_sit_1 (cost=0.42..8.44 rows=1 width=8) (never executed)

  • Index Cond: ("*SELECT* 2_1".codigo = contasareceber_codigo)
57. 0.000 0.000 ↓ 0.0 0

Index Scan using situacoescontas_pkey on situacoescontas sc_1 (cost=0.15..0.17 rows=1 width=125) (never executed)

  • Index Cond: (cr_sit_1.situacoesconta_codigo = codigo)
58. 0.000 0.000 ↓ 0.0 0

Index Scan using gruposcontas_pkey on gruposcontas grct_1 (cost=0.15..8.17 rows=1 width=122) (never executed)

  • Index Cond: (codigo = "*SELECT* 2_1".gruposcontas_codigo)
59. 0.000 0.000 ↓ 0.0 0

Seq Scan on tipodocumento t_2 (cost=0.00..1.21 rows=21 width=82) (never executed)

60. 0.000 0.000 ↓ 0.0 0

Index Scan using saidasnf_codigo_index on saidasnf snf (cost=0.42..8.44 rows=1 width=12) (never executed)

  • Index Cond: (codigo = "*SELECT* 2_1".saidasnf_codigo)
61. 0.001 0.027 ↓ 0.0 0 1

Subquery Scan on *SELECT* 3 (cost=339.09..404.16 rows=152 width=446) (actual time=0.027..0.027 rows=0 loops=1)

62. 0.004 0.026 ↓ 0.0 0 1

Hash Right Join (cost=339.09..402.64 rows=152 width=538) (actual time=0.026..0.026 rows=0 loops=1)

  • Hash Cond: (cat.contasareceber_avulsas_codigo = "*SELECT* 3_1".contasareceber_avulsas_codigo)
63. 0.000 0.000 ↓ 0.0 0

Seq Scan on contasareceber_avulsas_tecnicos cat (cost=0.00..17.80 rows=780 width=8) (never executed)

64. 0.000 0.022 ↓ 0.0 0 1

Hash (cost=338.60..338.60 rows=39 width=438) (actual time=0.022..0.022 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
65. 0.000 0.022 ↓ 0.0 0 1

Hash Left Join (cost=308.76..338.60 rows=39 width=438) (actual time=0.022..0.022 rows=0 loops=1)

  • Hash Cond: ("*SELECT* 3_1".tipodocumento_codigo = t_3.codigo)
66. 0.000 0.022 ↓ 0.0 0 1

Nested Loop Left Join (cost=307.29..337.01 rows=39 width=360) (actual time=0.022..0.022 rows=0 loops=1)

  • Join Filter: (c_2.codigo = "*SELECT* 3_1".clientes_codigo)
67. 0.005 0.022 ↓ 0.0 0 1

Hash Right Join (cost=307.00..328.12 rows=39 width=334) (actual time=0.022..0.022 rows=0 loops=1)

  • Hash Cond: (cav.contasareceber_avulsas_codigo = "*SELECT* 3_1".contasareceber_avulsas_codigo)
68. 0.000 0.000 ↓ 0.0 0

Seq Scan on contasareceber_avulsas_vendedores cav (cost=0.00..17.80 rows=780 width=8) (never executed)

69. 0.001 0.017 ↓ 0.0 0 1

Hash (cost=306.88..306.88 rows=10 width=330) (actual time=0.017..0.017 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
70. 0.000 0.016 ↓ 0.0 0 1

Nested Loop Left Join (cost=121.20..306.88 rows=10 width=330) (actual time=0.016..0.016 rows=0 loops=1)

71. 0.000 0.016 ↓ 0.0 0 1

Nested Loop Left Join (cost=121.05..305.23 rows=10 width=209) (actual time=0.016..0.016 rows=0 loops=1)

72. 0.000 0.016 ↓ 0.0 0 1

Nested Loop (cost=120.63..220.80 rows=10 width=205) (actual time=0.016..0.016 rows=0 loops=1)

73. 0.005 0.016 ↓ 0.0 0 1

Hash Right Join (cost=120.20..136.35 rows=10 width=205) (actual time=0.016..0.016 rows=0 loops=1)

  • Hash Cond: (grct_2.codigo = "*SELECT* 3_1".gruposcontas_codigo)
74. 0.000 0.000 ↓ 0.0 0

Seq Scan on gruposcontas grct_2 (cost=0.00..14.40 rows=440 width=122) (never executed)

75. 0.000 0.011 ↓ 0.0 0 1

Hash (cost=120.08..120.08 rows=10 width=87) (actual time=0.011..0.011 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
76. 0.001 0.011 ↓ 0.0 0 1

Append (cost=0.42..120.08 rows=10 width=87) (actual time=0.011..0.011 rows=0 loops=1)

77. 0.000 0.010 ↓ 0.0 0 1

Subquery Scan on *SELECT* 3_1 (cost=0.42..120.03 rows=10 width=87) (actual time=0.010..0.010 rows=0 loops=1)

78. 0.001 0.010 ↓ 0.0 0 1

Nested Loop (cost=0.42..119.93 rows=10 width=168) (actual time=0.010..0.010 rows=0 loops=1)

79. 0.009 0.009 ↓ 0.0 0 1

Seq Scan on contasareceber_avulsas crav (cost=0.00..35.50 rows=10 width=12) (actual time=0.009..0.009 rows=0 loops=1)

  • Filter: ((codigo IS NOT NULL) AND (clientes_codigo = 55))
  • Rows Removed by Filter: 7
80. 0.000 0.000 ↓ 0.0 0

Index Scan using contasareceber_pkey1 on contasareceber cr_2 (cost=0.42..8.44 rows=1 width=35) (never executed)

  • Index Cond: (codigo = crav.contasareceber_codigo)
81. 0.000 0.000 ↓ 0.0 0

Index Only Scan using contasareceber_faturamentos_pkey on contasareceber_faturamentos cr_fat_2 (cost=0.42..8.45 rows=1 width=4) (never executed)

  • Index Cond: ((contasareceber_codigo = "*SELECT* 3_1".codigo) AND (contasareceber_codigo IS NOT NULL))
  • Heap Fetches: 0
82. 0.000 0.000 ↓ 0.0 0

Index Scan using contasareceber_situacao_pkey on contasareceber_situacao cr_sit_2 (cost=0.42..8.44 rows=1 width=8) (never executed)

  • Index Cond: ("*SELECT* 3_1".codigo = contasareceber_codigo)
83. 0.000 0.000 ↓ 0.0 0

Index Scan using situacoescontas_pkey on situacoescontas sc_2 (cost=0.15..0.17 rows=1 width=125) (never executed)

  • Index Cond: (cr_sit_2.situacoesconta_codigo = codigo)
84. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.29..8.31 rows=1 width=30) (never executed)

85. 0.000 0.000 ↓ 0.0 0

Index Scan using unq_clientes on clientes c_2 (cost=0.29..8.30 rows=1 width=30) (never executed)

  • Index Cond: (codigo = 55)
86. 0.000 0.000 ↓ 0.0 0

Hash (cost=1.21..1.21 rows=21 width=82) (never executed)

87. 0.000 0.000 ↓ 0.0 0

Seq Scan on tipodocumento t_3 (cost=0.00..1.21 rows=21 width=82) (never executed)

88. 0.610 0.610 ↑ 1.0 1 610

Index Scan using vendedores_pkey1 on vendedores v (cost=0.14..0.23 rows=1 width=13) (actual time=0.001..0.001 rows=1 loops=610)

  • Index Cond: (codigo = "*SELECT* 1".vendedores_codigo)
89. 0.000 0.000 ↓ 0.0 0 610

Index Scan using tecnicos_pkey on tecnicos t (cost=0.14..0.38 rows=1 width=122) (actual time=0.000..0.000 rows=0 loops=610)

  • Index Cond: (codigo = "*SELECT* 1".tecnicos_codigo)
90. 1.830 1.830 ↑ 1.0 1 610

Index Scan using contasareceber_pagtos_contasareceber_faturamentos_cr_codigo_idx on contasareceber_pagtos crpg (cost=0.42..8.24 rows=1 width=12) (actual time=0.003..0.003 rows=1 loops=610)

  • Index Cond: (contasareceber_faturamentos_cr_codigo = "*SELECT* 1".codigo)
Planning time : 15.531 ms
Execution time : 137.216 ms