explain.depesz.com

PostgreSQL's explain analyze made readable

Result: dSB7

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=1,198,154.42..1,237,576.82 rows=50 width=582) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Unique (cost=1,198,154.42..1,355,844.03 rows=200 width=582) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,198,154.42..1,353,711.19 rows=853,136 width=582) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=1,198,154.28..1,217,233.42 rows=853,136 width=463) (actual rows= loops=)

  • Merge Cond: ("*SELECT* 1".codigo = crpg.contasareceber_faturamentos_cr_codigo)
5. 0.000 0.000 ↓ 0.0

Sort (cost=1,087,213.87..1,089,346.71 rows=853,136 width=455) (actual rows= loops=)

  • Sort Key: "*SELECT* 1".codigo
6. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=152,594.85..653,246.66 rows=853,136 width=455) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 1".vendedores_codigo = v.codigo)
7. 0.000 0.000 ↓ 0.0

Append (cost=152,591.98..650,956.85 rows=853,136 width=446) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1 (cost=152,591.98..522,320.27 rows=820,000 width=446) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=152,591.98..514,120.27 rows=820,000 width=538) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 1_1".tipodocumento_codigo = t_1.codigo)
10. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=152,590.50..304,870.68 rows=820,000 width=364) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 1_1".gruposcontas_codigo = grct.codigo)
11. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=152,570.60..302,677.54 rows=820,000 width=246) (actual rows= loops=)

  • Hash Cond: (cr_sit.situacoesconta_codigo = sc.codigo)
12. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=152,550.93..300,484.15 rows=820,000 width=125) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 1_1".clientes_codigo = c.codigo)
13. 0.000 0.000 ↓ 0.0

Hash Join (cost=151,258.93..297,039.04 rows=820,000 width=99) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 1_1".prevendas_codigo = pv.codigo)
14. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=126,546.82..243,791.39 rows=820,000 width=91) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 1_1".codigo = cr_sit.contasareceber_codigo)
15. 0.000 0.000 ↓ 0.0

Hash Join (cost=101,262.89..190,728.96 rows=820,000 width=87) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 1_1".codigo = cr_fat.contasareceber_codigo)
16. 0.000 0.000 ↓ 0.0

Append (cost=74,385.76..136,073.31 rows=820,000 width=87) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 1_1 (cost=74,385.76..131,973.31 rows=820,000 width=87) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Hash Join (cost=74,385.76..123,773.31 rows=820,000 width=168) (actual rows= loops=)

  • Hash Cond: (pvpg_cr.contasareceber_codigo = cr.codigo)
19. 0.000 0.000 ↓ 0.0

Hash Join (cost=40,879.81..73,699.86 rows=820,000 width=12) (actual rows= loops=)

  • Hash Cond: (pvpg.codprevenda = pv_1.codigo)
20. 0.000 0.000 ↓ 0.0

Hash Join (cost=16,639.69..39,012.21 rows=820,000 width=8) (actual rows= loops=)

  • Hash Cond: (pvpg_cr.prevendas_pagtos_codigo = pvpg.codigo)
21. 0.000 0.000 ↓ 0.0

Seq Scan on prevendas_pagtos_contasareceber pvpg_cr (cost=0.00..11,829.00 rows=820,000 width=8) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Hash (cost=8,313.53..8,313.53 rows=507,453 width=8) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Seq Scan on prevenda_pagto pvpg (cost=0.00..8,313.53 rows=507,453 width=8) (actual rows= loops=)

  • Filter: (codprevenda IS NOT NULL)
24. 0.000 0.000 ↓ 0.0

Hash (cost=16,314.72..16,314.72 rows=483,072 width=8) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Seq Scan on prevendas pv_1 (cost=0.00..16,314.72 rows=483,072 width=8) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Hash (cost=16,848.42..16,848.42 rows=820,042 width=35) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Seq Scan on contasareceber cr (cost=0.00..16,848.42 rows=820,042 width=35) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Hash (cost=13,423.06..13,423.06 rows=820,006 width=4) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Seq Scan on contasareceber_faturamentos cr_fat (cost=0.00..13,423.06 rows=820,006 width=4) (actual rows= loops=)

  • Filter: (contasareceber_codigo IS NOT NULL)
30. 0.000 0.000 ↓ 0.0

Hash (cost=11,829.41..11,829.41 rows=820,041 width=8) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Seq Scan on contasareceber_situacao cr_sit (cost=0.00..11,829.41 rows=820,041 width=8) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Hash (cost=16,314.72..16,314.72 rows=483,072 width=12) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Seq Scan on prevendas pv (cost=0.00..16,314.72 rows=483,072 width=12) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Hash (cost=1,109.22..1,109.22 rows=14,622 width=30) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Seq Scan on clientes c (cost=0.00..1,109.22 rows=14,622 width=30) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Hash (cost=14.30..14.30 rows=430 width=125) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Seq Scan on situacoescontas sc (cost=0.00..14.30 rows=430 width=125) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Hash (cost=14.40..14.40 rows=440 width=122) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Seq Scan on gruposcontas grct (cost=0.00..14.40 rows=440 width=122) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Hash (cost=1.21..1.21 rows=21 width=82) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Seq Scan on tipodocumento t_1 (cost=0.00..1.21 rows=21 width=82) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2 (cost=1,296.31..71,942.14 rows=2,260 width=446) (actual rows= loops=)

43. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1,296.31..71,919.54 rows=2,260 width=538) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,295.88..58,990.49 rows=2,260 width=434) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 2_1".tipodocumento_codigo = t_2.codigo)
45. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,294.41..58,982.97 rows=2,260 width=356) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,294.26..58,566.25 rows=2,260 width=238) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,294.12..58,193.30 rows=2,260 width=117) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,293.69..43,757.25 rows=2,260 width=113) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 2_1".clientes_codigo = c_1.codigo)
49. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.70..42,459.33 rows=2,260 width=87) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

Append (cost=1.27..27,493.63 rows=2,260 width=87) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 2_1 (cost=1.27..27,482.33 rows=2,260 width=87) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..27,459.73 rows=2,260 width=168) (actual rows= loops=)

53. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..26,091.05 rows=2,260 width=39) (actual rows= loops=)

54. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..16,180.65 rows=2,260 width=39) (actual rows= loops=)

55. 0.000 0.000 ↓ 0.0

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

56. 0.000 0.000 ↓ 0.0

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

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

Index Scan using saidasnf_pagto_pkey on saidasnf_pagto snfpg (cost=0.42..4.39 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (codigo = snfpg_cr.saidasnf_pagtos_codigo)
  • Filter: (codsaidasnf IS NOT NULL)
58. 0.000 0.000 ↓ 0.0

Index Scan using saidasnf_codigo_index on saidasnf snf_1 (cost=0.42..0.61 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (codigo = snfpg.codsaidasnf)
59. 0.000 0.000 ↓ 0.0

Index Only Scan using contasareceber_faturamentos_pkey on contasareceber_faturamentos cr_fat_1 (cost=0.42..6.62 rows=1 width=4) (actual rows= loops=)

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

Hash (cost=1,109.22..1,109.22 rows=14,622 width=30) (actual rows= loops=)

61. 0.000 0.000 ↓ 0.0

Seq Scan on clientes c_1 (cost=0.00..1,109.22 rows=14,622 width=30) (actual rows= loops=)

62. 0.000 0.000 ↓ 0.0

Index Scan using contasareceber_situacao_pkey on contasareceber_situacao cr_sit_1 (cost=0.42..6.39 rows=1 width=8) (actual rows= loops=)

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

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

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

Index Scan using gruposcontas_pkey on gruposcontas grct_1 (cost=0.15..0.18 rows=1 width=122) (actual rows= loops=)

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

Hash (cost=1.21..1.21 rows=21 width=82) (actual rows= loops=)

66. 0.000 0.000 ↓ 0.0

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

67. 0.000 0.000 ↓ 0.0

Index Scan using saidasnf_codigo_index on saidasnf snf (cost=0.42..5.47 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (codigo = "*SELECT* 2_1".saidasnf_codigo)
68. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 3 (cost=43,727.86..52,428.76 rows=30,876 width=446) (actual rows= loops=)

69. 0.000 0.000 ↓ 0.0

Merge Right Join (cost=43,727.86..52,120.00 rows=30,876 width=538) (actual rows= loops=)

  • Merge Cond: (cat.contasareceber_avulsas_codigo = "*SELECT* 3_1".contasareceber_avulsas_codigo)
70. 0.000 0.000 ↓ 0.0

Sort (cost=55.27..57.22 rows=780 width=8) (actual rows= loops=)

  • Sort Key: cat.contasareceber_avulsas_codigo
71. 0.000 0.000 ↓ 0.0

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

72. 0.000 0.000 ↓ 0.0

Materialize (cost=43,672.59..43,821.29 rows=7,917 width=438) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=43,672.59..43,801.50 rows=7,917 width=438) (actual rows= loops=)

  • Merge Cond: ("*SELECT* 3_1".contasareceber_avulsas_codigo = cav.contasareceber_avulsas_codigo)
74. 0.000 0.000 ↓ 0.0

Sort (cost=43,617.33..43,622.40 rows=2,030 width=434) (actual rows= loops=)

  • Sort Key: "*SELECT* 3_1".contasareceber_avulsas_codigo
75. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,314.79..43,505.80 rows=2,030 width=434) (actual rows= loops=)

76. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,314.22..29,856.00 rows=2,030 width=309) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 3_1".tipodocumento_codigo = t_3.codigo)
77. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1,312.75..29,849.08 rows=2,030 width=231) (actual rows= loops=)

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

Hash Left Join (cost=1,292.85..29,823.80 rows=2,030 width=113) (actual rows= loops=)

  • Hash Cond: ("*SELECT* 3_1".clientes_codigo = c_2.codigo)
79. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..28,526.48 rows=2,030 width=87) (actual rows= loops=)

80. 0.000 0.000 ↓ 0.0

Append (cost=0.42..14,791.13 rows=2,030 width=87) (actual rows= loops=)

81. 0.000 0.000 ↓ 0.0

Subquery Scan on *SELECT* 3_1 (cost=0.42..14,780.98 rows=2,030 width=87) (actual rows= loops=)

82. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..14,760.68 rows=2,030 width=168) (actual rows= loops=)

83. 0.000 0.000 ↓ 0.0

Seq Scan on contasareceber_avulsas crav (cost=0.00..30.40 rows=2,030 width=12) (actual rows= loops=)

  • Filter: (codigo IS NOT NULL)
84. 0.000 0.000 ↓ 0.0

Index Scan using contasareceber_pkey1 on contasareceber cr_2 (cost=0.42..7.26 rows=1 width=35) (actual rows= loops=)

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

Index Only Scan using contasareceber_faturamentos_pkey on contasareceber_faturamentos cr_fat_2 (cost=0.42..6.77 rows=1 width=4) (actual rows= loops=)

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

Hash (cost=1,109.22..1,109.22 rows=14,622 width=30) (actual rows= loops=)

87. 0.000 0.000 ↓ 0.0

Seq Scan on clientes c_2 (cost=0.00..1,109.22 rows=14,622 width=30) (actual rows= loops=)

88. 0.000 0.000 ↓ 0.0

Hash (cost=14.40..14.40 rows=440 width=122) (actual rows= loops=)

89. 0.000 0.000 ↓ 0.0

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

90. 0.000 0.000 ↓ 0.0

Hash (cost=1.21..1.21 rows=21 width=82) (actual rows= loops=)

91. 0.000 0.000 ↓ 0.0

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

92. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.57..6.71 rows=1 width=129) (actual rows= loops=)

93. 0.000 0.000 ↓ 0.0

Index Scan using contasareceber_situacao_pkey on contasareceber_situacao cr_sit_2 (cost=0.42..6.55 rows=1 width=8) (actual rows= loops=)

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

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

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

Sort (cost=55.27..57.22 rows=780 width=8) (actual rows= loops=)

  • Sort Key: cav.contasareceber_avulsas_codigo
96. 0.000 0.000 ↓ 0.0

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

97. 0.000 0.000 ↓ 0.0

Hash (cost=2.39..2.39 rows=39 width=13) (actual rows= loops=)

98. 0.000 0.000 ↓ 0.0

Seq Scan on vendedores v (cost=0.00..2.39 rows=39 width=13) (actual rows= loops=)

99. 0.000 0.000 ↓ 0.0

Materialize (cost=110,940.41..114,973.25 rows=806,569 width=12) (actual rows= loops=)

100. 0.000 0.000 ↓ 0.0

Sort (cost=110,940.41..112,956.83 rows=806,569 width=12) (actual rows= loops=)

  • Sort Key: crpg.contasareceber_faturamentos_cr_codigo
101. 0.000 0.000 ↓ 0.0

Seq Scan on contasareceber_pagtos crpg (cost=0.00..18,023.69 rows=806,569 width=12) (actual rows= loops=)

102. 0.000 0.000 ↓ 0.0

Index Scan using tecnicos_pkey on tecnicos t (cost=0.14..0.16 rows=1 width=122) (actual rows= loops=)

  • Index Cond: (codigo = "*SELECT* 1".tecnicos_codigo)