explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jQTf

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

Sort (cost=2,746,706,169.07..2,746,706,195.84 rows=10,710 width=830) (actual rows= loops=)

  • Sort Key: c.id_loja, cc.conta1, cc.conta2, cc.conta3, cc.conta4, cc.conta5
2. 0.000 0.000 ↓ 0.0

HashAggregate (cost=2,746,705,238.01..2,746,705,345.11 rows=10,710 width=830) (actual rows= loops=)

  • Group Key: c.id_loja, cc.conta1, cc.conta2, cc.conta3, cc.conta4, cc.conta5, ((SubPlan 13)), ((SubPlan 14)), ((SubPlan 15)), ((SubPlan 16)), cc.id, ((SubPlan 17)), ((SubPlan 18)), ((SubPlan 19)), ((SubPlan 20)), cc.descricao, ((SubPlan 21)), ((SubP (...)
3. 0.000 0.000 ↓ 0.0

Append (cost=1,372,924,616.07..2,746,704,729.29 rows=10,710 width=830) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Unique (cost=1,372,924,616.07..1,372,924,883.82 rows=5,355 width=722) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Sort (cost=1,372,924,616.07..1,372,924,629.46 rows=5,355 width=722) (actual rows= loops=)

  • Sort Key: c.id_loja, cc.conta1, cc.conta2, cc.conta3, cc.conta4, cc.conta5, ((SubPlan 13)), ((SubPlan 14)), ((SubPlan 15)), ((SubPlan 16)), cc.id, ((SubPlan 17)), ((SubPlan 18)), ((SubPlan 19)), ((SubPlan 20)), cc.descricao, ((Sub (...)
6. 0.000 0.000 ↓ 0.0

Group (cost=803,562.82..1,372,924,284.42 rows=5,355 width=722) (actual rows= loops=)

  • Group Key: c.id_loja, cc.id
7. 0.000 0.000 ↓ 0.0

Sort (cost=803,562.82..803,802.99 rows=96,070 width=58) (actual rows= loops=)

  • Sort Key: c.id_loja, cc.id
8. 0.000 0.000 ↓ 0.0

Hash Join (cost=113,447.14..795,612.16 rows=96,070 width=58) (actual rows= loops=)

  • Hash Cond: (c.id_loja = l.id)
9. 0.000 0.000 ↓ 0.0

Hash Join (cost=113,434.51..794,278.57 rows=96,070 width=58) (actual rows= loops=)

  • Hash Cond: (cl.id_contabilidade = c.id)
10. 0.000 0.000 ↓ 0.0

Nested Loop (cost=145.45..677,810.94 rows=591,431 width=62) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Index Scan using pk_contacontabilfiscal on contacontabilfiscal cc (cost=0.28..381.46 rows=315 width=54) (actual rows= loops=)

  • Filter: (resultado AND (id_situacaocadastro = 1))
12. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidadelancamento cl (cost=145.17..2,068.01 rows=8,256 width=12) (actual rows= loops=)

  • Recheck Cond: (id_contacontabilfiscal = cc.id)
13. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidadelancamento (cost=0.00..143.10 rows=8,256 width=0) (actual rows= loops=)

  • Index Cond: (id_contacontabilfiscal = cc.id)
14. 0.000 0.000 ↓ 0.0

Hash (cost=107,833.33..107,833.33 rows=436,458 width=8) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidade c (cost=55,065.10..107,833.33 rows=436,458 width=8) (actual rows= loops=)

  • Recheck Cond: ((data >= '2018-12-31'::date) AND (data <= '2019-12-31'::date))
  • Filter: (id_loja = ANY ('{1,2}'::integer[]))
16. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidade (cost=0.00..54,955.99 rows=1,256,356 width=0) (actual rows= loops=)

  • Index Cond: ((data >= '2018-12-31'::date) AND (data <= '2019-12-31'::date))
17. 0.000 0.000 ↓ 0.0

Hash (cost=12.41..12.41 rows=18 width=4) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Index Only Scan using pk_loja on loja l (cost=0.14..12.41 rows=18 width=4) (actual rows= loops=)

19.          

SubPlan (for Group)

20. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_8 (cost=0.28..27.50 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((conta1 = cc.conta1) AND (nivel = 1))
21. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_9 (cost=0.28..9.42 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((conta1 = cc.conta1) AND (conta2 = cc.conta2) AND (nivel = 2))
22. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_10 (cost=0.28..8.37 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((conta1 = cc.conta1) AND (conta2 = cc.conta2) AND (conta3 = cc.conta3) AND (nivel = 3))
23. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_11 (cost=0.28..8.31 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((conta1 = cc.conta1) AND (conta2 = cc.conta2) AND (conta3 = cc.conta3) AND (conta4 = cc.conta4) AND (nivel = 4))
24. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_12 (cost=0.28..27.50 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((conta1 = cc.conta1) AND (nivel = 1))
25. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_13 (cost=0.28..9.42 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((conta1 = cc.conta1) AND (conta2 = cc.conta2) AND (nivel = 2))
26. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_14 (cost=0.28..8.37 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((conta1 = cc.conta1) AND (conta2 = cc.conta2) AND (conta3 = cc.conta3) AND (nivel = 3))
27. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_15 (cost=0.28..8.31 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((conta1 = cc.conta1) AND (conta2 = cc.conta2) AND (conta3 = cc.conta3) AND (conta4 = cc.conta4) AND (nivel = 4))
28. 0.000 0.000 ↓ 0.0

Aggregate (cost=85,381.53..85,381.54 rows=1 width=32) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Nested Loop (cost=156.85..85,380.96 rows=227 width=4) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidadelancamento cl0_3 (cost=156.42..26,805.92 rows=8,256 width=12) (actual rows= loops=)

  • Recheck Cond: (id_contacontabilfiscal = cc.id)
31. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidadelancamento (cost=0.00..154.35 rows=8,256 width=0) (actual rows= loops=)

  • Index Cond: (id_contacontabilfiscal = cc.id)
32. 0.000 0.000 ↓ 0.0

Index Scan using pk_contabilidade on contabilidade c0_3 (cost=0.43..7.08 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = cl0_3.id_contabilidade)
  • Filter: ((data >= '2018-12-31'::date) AND (data <= '2019-12-31'::date) AND (id_loja = c.id_loja))
33. 0.000 0.000 ↓ 0.0

Aggregate (cost=85,381.53..85,381.54 rows=1 width=32) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Nested Loop (cost=156.85..85,380.96 rows=227 width=4) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidadelancamento cl0_4 (cost=156.42..26,805.92 rows=8,256 width=12) (actual rows= loops=)

  • Recheck Cond: (id_contacontabilfiscal = cc.id)
36. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidadelancamento (cost=0.00..154.35 rows=8,256 width=0) (actual rows= loops=)

  • Index Cond: (id_contacontabilfiscal = cc.id)
37. 0.000 0.000 ↓ 0.0

Index Scan using pk_contabilidade on contabilidade c0_4 (cost=0.43..7.08 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = cl0_4.id_contabilidade)
  • Filter: ((data >= '2018-12-31'::date) AND (data <= '2019-12-31'::date) AND (id_loja = c.id_loja))
38. 0.000 0.000 ↓ 0.0

Aggregate (cost=85,361.28..85,361.29 rows=1 width=32) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Nested Loop (cost=156.85..85,360.32 rows=193 width=8) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidadelancamento cl0_5 (cost=156.42..26,805.92 rows=8,256 width=16) (actual rows= loops=)

  • Recheck Cond: (id_contacontabilfiscal = cc.id)
41. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidadelancamento (cost=0.00..154.35 rows=8,256 width=0) (actual rows= loops=)

  • Index Cond: (id_contacontabilfiscal = cc.id)
42. 0.000 0.000 ↓ 0.0

Index Scan using pk_contabilidade on contabilidade c0_5 (cost=0.43..7.08 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = cl0_5.id_contabilidade)
  • Filter: ((data < '2018-12-31'::date) AND (id_loja = c.id_loja))
43. 0.000 0.000 ↓ 0.0

Unique (cost=1,373,779,470.61..1,373,779,738.36 rows=5,355 width=722) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Sort (cost=1,373,779,470.61..1,373,779,484.00 rows=5,355 width=722) (actual rows= loops=)

  • Sort Key: c_1.id_loja, cc_1.conta1, cc_1.conta2, cc_1.conta3, cc_1.conta4, cc_1.conta5, ((SubPlan 1)), ((SubPlan 2)), ((SubPlan 3)), ((SubPlan 4)), cc_1.id, ((SubPlan 5)), ((SubPlan 6)), ((SubPlan 7)), ((SubPlan 8)), cc_1.descrica (...)
45. 0.000 0.000 ↓ 0.0

Group (cost=1,658,777.62..1,373,779,138.96 rows=5,355 width=722) (actual rows= loops=)

  • Group Key: c_1.id_loja, cc_1.id
46. 0.000 0.000 ↓ 0.0

Sort (cost=1,658,777.62..1,658,897.71 rows=48,035 width=58) (actual rows= loops=)

  • Sort Key: c_1.id_loja, cc_1.id
47. 0.000 0.000 ↓ 0.0

Hash Join (cost=961,221.38..1,655,042.47 rows=48,035 width=58) (actual rows= loops=)

  • Hash Cond: (c_1.id_loja = l_1.id)
48. 0.000 0.000 ↓ 0.0

Hash Join (cost=961,208.75..1,654,369.36 rows=48,035 width=58) (actual rows= loops=)

  • Hash Cond: (cl_1.id_contabilidade = c_1.id)
49. 0.000 0.000 ↓ 0.0

Hash Join (cost=847,919.69..1,539,491.01 rows=295,715 width=62) (actual rows= loops=)

  • Hash Cond: (cl_1.id_contacontabilfiscal = cc_1.id)
50. 0.000 0.000 ↓ 0.0

Index Scan using idx2_contabilidadelancamento on contabilidadelancamento cl_1 (cost=847,534.29..1,518,377.38 rows=4,738,956 width=12) (actual rows= loops=)

  • Filter: (NOT (hashed SubPlan 12))
51.          

SubPlan (for Index Scan)

52. 0.000 0.000 ↓ 0.0

Merge Join (cost=1,968.68..823,839.08 rows=9,477,911 width=4) (actual rows= loops=)

  • Merge Cond: (c1.id = cl1.id_contabilidade)
53. 0.000 0.000 ↓ 0.0

Index Only Scan using pk_contabilidade on contabilidade c1 (cost=0.43..100,321.00 rows=2,686,931 width=4) (actual rows= loops=)

54. 0.000 0.000 ↓ 0.0

Index Scan using idx2_contabilidadelancamento on contabilidadelancamento cl1 (cost=0.43..647,148.75 rows=9,477,911 width=12) (actual rows= loops=)

55. 0.000 0.000 ↓ 0.0

Hash (cost=381.46..381.46 rows=315 width=54) (actual rows= loops=)

56. 0.000 0.000 ↓ 0.0

Index Scan using pk_contacontabilfiscal on contacontabilfiscal cc_1 (cost=0.28..381.46 rows=315 width=54) (actual rows= loops=)

  • Filter: (resultado AND (id_situacaocadastro = 1))
57. 0.000 0.000 ↓ 0.0

Hash (cost=107,833.33..107,833.33 rows=436,458 width=8) (actual rows= loops=)

58. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidade c_1 (cost=55,065.10..107,833.33 rows=436,458 width=8) (actual rows= loops=)

  • Recheck Cond: ((data >= '2018-12-31'::date) AND (data <= '2019-12-31'::date))
  • Filter: (id_loja = ANY ('{1,2}'::integer[]))
59. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidade (cost=0.00..54,955.99 rows=1,256,356 width=0) (actual rows= loops=)

  • Index Cond: ((data >= '2018-12-31'::date) AND (data <= '2019-12-31'::date))
60. 0.000 0.000 ↓ 0.0

Hash (cost=12.41..12.41 rows=18 width=4) (actual rows= loops=)

61. 0.000 0.000 ↓ 0.0

Index Only Scan using pk_loja on loja l_1 (cost=0.14..12.41 rows=18 width=4) (actual rows= loops=)

62.          

SubPlan (for Group)

63. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal (cost=0.28..27.50 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((conta1 = cc_1.conta1) AND (nivel = 1))
64. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_1 (cost=0.28..9.42 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((conta1 = cc_1.conta1) AND (conta2 = cc_1.conta2) AND (nivel = 2))
65. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_2 (cost=0.28..8.37 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((conta1 = cc_1.conta1) AND (conta2 = cc_1.conta2) AND (conta3 = cc_1.conta3) AND (nivel = 3))
66. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_3 (cost=0.28..8.31 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((conta1 = cc_1.conta1) AND (conta2 = cc_1.conta2) AND (conta3 = cc_1.conta3) AND (conta4 = cc_1.conta4) AND (nivel = 4))
67. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_4 (cost=0.28..27.50 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((conta1 = cc_1.conta1) AND (nivel = 1))
68. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_5 (cost=0.28..9.42 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((conta1 = cc_1.conta1) AND (conta2 = cc_1.conta2) AND (nivel = 2))
69. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_6 (cost=0.28..8.37 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((conta1 = cc_1.conta1) AND (conta2 = cc_1.conta2) AND (conta3 = cc_1.conta3) AND (nivel = 3))
70. 0.000 0.000 ↓ 0.0

Index Scan using idx_contacontabil on contacontabilfiscal contacontabilfiscal_7 (cost=0.28..8.31 rows=1 width=30) (actual rows= loops=)

  • Index Cond: ((conta1 = cc_1.conta1) AND (conta2 = cc_1.conta2) AND (conta3 = cc_1.conta3) AND (conta4 = cc_1.conta4) AND (nivel = 4))
71. 0.000 0.000 ↓ 0.0

Aggregate (cost=85,381.53..85,381.54 rows=1 width=32) (actual rows= loops=)

72. 0.000 0.000 ↓ 0.0

Nested Loop (cost=156.85..85,380.96 rows=227 width=4) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidadelancamento cl0 (cost=156.42..26,805.92 rows=8,256 width=12) (actual rows= loops=)

  • Recheck Cond: (id_contacontabilfiscal = cc_1.id)
74. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidadelancamento (cost=0.00..154.35 rows=8,256 width=0) (actual rows= loops=)

  • Index Cond: (id_contacontabilfiscal = cc_1.id)
75. 0.000 0.000 ↓ 0.0

Index Scan using pk_contabilidade on contabilidade c0 (cost=0.43..7.08 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = cl0.id_contabilidade)
  • Filter: ((data >= '2018-12-31'::date) AND (data <= '2019-12-31'::date) AND (id_loja = c_1.id_loja))
76. 0.000 0.000 ↓ 0.0

Aggregate (cost=85,381.53..85,381.54 rows=1 width=32) (actual rows= loops=)

77. 0.000 0.000 ↓ 0.0

Nested Loop (cost=156.85..85,380.96 rows=227 width=4) (actual rows= loops=)

78. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidadelancamento cl0_1 (cost=156.42..26,805.92 rows=8,256 width=12) (actual rows= loops=)

  • Recheck Cond: (id_contacontabilfiscal = cc_1.id)
79. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidadelancamento (cost=0.00..154.35 rows=8,256 width=0) (actual rows= loops=)

  • Index Cond: (id_contacontabilfiscal = cc_1.id)
80. 0.000 0.000 ↓ 0.0

Index Scan using pk_contabilidade on contabilidade c0_1 (cost=0.43..7.08 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = cl0_1.id_contabilidade)
  • Filter: ((data >= '2018-12-31'::date) AND (data <= '2019-12-31'::date) AND (id_loja = c_1.id_loja))
81. 0.000 0.000 ↓ 0.0

Aggregate (cost=85,361.28..85,361.29 rows=1 width=32) (actual rows= loops=)

82. 0.000 0.000 ↓ 0.0

Nested Loop (cost=156.85..85,360.32 rows=193 width=8) (actual rows= loops=)

83. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on contabilidadelancamento cl0_2 (cost=156.42..26,805.92 rows=8,256 width=16) (actual rows= loops=)

  • Recheck Cond: (id_contacontabilfiscal = cc_1.id)
84. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on idx1_contabilidadelancamento (cost=0.00..154.35 rows=8,256 width=0) (actual rows= loops=)

  • Index Cond: (id_contacontabilfiscal = cc_1.id)
85. 0.000 0.000 ↓ 0.0

Index Scan using pk_contabilidade on contabilidade c0_2 (cost=0.43..7.08 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = cl0_2.id_contabilidade)
  • Filter: ((data < '2018-12-31'::date) AND (id_loja = c_1.id_loja))