explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7fNoy

Settings

Optimization(s) for this plan:

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

Aggregate (cost=171,429.35..171,429.36 rows=1 width=96) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Hash Semi Join (cost=134,191.30..171,421.69 rows=1,020 width=10) (actual rows= loops=)

  • Hash Cond: (crpg.contasareceber_faturamentos_cr_codigo = cr.codigo)
3. 0.000 0.000 ↓ 0.0

Hash Anti Join (cost=111.58..36,803.84 rows=200,680 width=14) (actual rows= loops=)

  • Hash Cond: (crpg.codigo = contasareceber_pagtos_estornos.contasareceber_pagtos_codigo)
4. 0.000 0.000 ↓ 0.0

Seq Scan on contasareceber_pagtos crpg (cost=0.00..34,155.07 rows=201,642 width=18) (actual rows= loops=)

  • Filter: (CASE WHEN (to_date('2019-01-01'::text, 'YYYY-MM-DD'::text) IS NOT NULL) THEN ((dhpagamento)::date >= to_date('2019-01-01'::text, 'YYYY-MM-DD'::text)) ELSE true END AND CASE WHEN (to_date('2020-12-31'::text, 'YYYY-MM-DD'::text) IS NOT NULL) THEN ((dhpagamento)::date <= to_date('2020-12-31'::text, 'YYYY-MM-DD'::text)) ELSE true END)
5. 0.000 0.000 ↓ 0.0

Hash (cost=63.48..63.48 rows=3,848 width=4) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Seq Scan on contasareceber_pagtos_estornos (cost=0.00..63.48 rows=3,848 width=4) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Hash (cost=134,028.47..134,028.47 rows=4,100 width=4) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=77,571.81..134,028.47 rows=4,100 width=4) (actual rows= loops=)

  • Hash Cond: (cr.codigo = crav.contasareceber_codigo)
  • Filter: (CASE WHEN (crav.clientes_codigo IS NOT NULL) THEN crav.clientes_codigo WHEN (pv.codcliente IS NOT NULL) THEN pv.codcliente WHEN (snf.codcliente IS NOT NULL) THEN snf.codcliente ELSE NULL::integer END = 15774)
9. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=77,515.91..131,819.95 rows=820,041 width=12) (actual rows= loops=)

  • Hash Cond: (cr.codigo = snfpg_cr.contasareceber_codigo)
10. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=66,175.86..117,382.15 rows=820,041 width=8) (actual rows= loops=)

  • Hash Cond: (pvpg.codprevenda = pv.codigo)
11. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=41,922.74..82,681.40 rows=820,041 width=8) (actual rows= loops=)

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

Hash Left Join (cost=25,283.00..55,498.03 rows=820,041 width=8) (actual rows= loops=)

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

Seq Scan on contasareceber cr (cost=0.00..16,848.41 rows=820,041 width=12) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Hash (cost=11,829.00..11,829.00 rows=820,000 width=8) (actual rows= loops=)

15. 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=)

16. 0.000 0.000 ↓ 0.0

Hash (cost=8,313.55..8,313.55 rows=507,455 width=8) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

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

18. 0.000 0.000 ↓ 0.0

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

19. 0.000 0.000 ↓ 0.0

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

20. 0.000 0.000 ↓ 0.0

Hash (cost=11,311.80..11,311.80 rows=2,260 width=8) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.84..11,311.80 rows=2,260 width=8) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.42..9,943.00 rows=2,260 width=8) (actual rows= loops=)

23. 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=)

24. 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: (snfpg_cr.saidasnf_pagtos_codigo = codigo)
25. 0.000 0.000 ↓ 0.0

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

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

Hash (cost=30.40..30.40 rows=2,040 width=12) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

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