explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yqr2 : Optimization for: plan #7fNoy

Settings

Optimization path:

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

Aggregate (cost=136,216.71..136,216.72 rows=1 width=96) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop (cost=77,572.23..136,209.15 rows=1,008 width=10) (actual rows= loops=)

3. 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)
4. 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)
5. 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)
6. 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)
7. 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)
8. 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=)

9. 0.000 0.000 ↓ 0.0

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

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

11. 0.000 0.000 ↓ 0.0

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

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

13. 0.000 0.000 ↓ 0.0

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

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

15. 0.000 0.000 ↓ 0.0

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

16. 0.000 0.000 ↓ 0.0

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

17. 0.000 0.000 ↓ 0.0

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

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

19. 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)
20. 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)
21. 0.000 0.000 ↓ 0.0

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

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

23. 0.000 0.000 ↓ 0.0

Index Scan using contasareceber_pagtos_contasareceber_faturamentos_cr_codigo_idx on contasareceber_pagtos crpg (cost=0.42..0.52 rows=1 width=14) (actual rows= loops=)

  • Index Cond: (contasareceber_faturamentos_cr_codigo = cr.codigo)
  • 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)