explain.depesz.com

PostgreSQL's explain analyze made readable

Result: N2rG

Settings
# exclusive inclusive rows x rows loops node
1. 230.709 392.545 ↓ 8.0 66,909 1

Hash Join (cost=10,000,000,005.64..10,000,126,821.30 rows=8,364 width=222) (actual time=5.960..392.545 rows=66,909 loops=1)

  • Hash Cond: (a_8.fk_0000 = b_7.fk_0000)
  • Join Filter: ((SubPlan 3) AND (SubPlan 4) AND CASE WHEN (b_7.tipo = 'C100'::bpchar) THEN ((CASE WHEN (a_8.dt_e_s <> ''::bpchar) THEN to_date((a_8.dt_e_s)::text, 'ddMMyyyy'::text) ELSE to_date((a_8.dt_doc)::text, 'ddMMyyyy'::text) END >= (SubPlan 1)) AND (CASE WHEN (a_8.dt_e_s <> ''::bpchar) THEN to_date((a_8.dt_e_s)::text, 'ddMMyyyy'::text) ELSE to_date((a_8.dt_doc)::text, 'ddMMyyyy'::text) END <= $1)) ELSE true END)
2.          

Initplan (for Hash Join)

3. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.00..1.01 rows=1 width=4) (never executed)

4. 0.000 0.000 ↓ 0.0 0

Seq Scan on tab_cenario_fiscal_parametros c_1 (cost=0.00..1.01 rows=1 width=4) (never executed)

5. 22.154 22.154 ↑ 1.0 66,909 1

Seq Scan on reg_c100 a_8 (cost=0.00..3,243.09 rows=66,909 width=156) (actual time=0.024..22.154 rows=66,909 loops=1)

6. 0.009 5.864 ↑ 4.0 1 1

Hash (cost=10,000,000,004.57..10,000,000,004.57 rows=4 width=126) (actual time=5.864..5.864 rows=1 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
7. 0.002 5.855 ↑ 4.0 1 1

Subquery Scan on b_7 (cost=10,000,000,000.00..10,000,000,004.57 rows=4 width=126) (actual time=5.852..5.855 rows=1 loops=1)

8. 5.828 5.853 ↑ 4.0 1 1

Nested Loop (cost=10,000,000,000.00..10,000,000,004.53 rows=4 width=140) (actual time=5.851..5.853 rows=1 loops=1)

  • Join Filter: CASE WHEN (a_9.tipo = '0000'::bpchar) THEN ((to_date(""substring""((b_8.dt_in)::text, 3, 6), 'MMyyyy'::text) >= to_date((a_9.data_inicial)::text, 'yyyyMM'::text)) AND (to_date(""substring""((b_8.dt_in)::text, 3, 6), 'MMyyyy'::text) <= to_date((a_9.data_final)::text, 'yyyyMM'::text))) ELSE true END
9. 0.013 0.013 ↑ 1.0 1 1

Seq Scan on tab_cenario_fiscal_parametros a_9 (cost=0.00..1.01 rows=1 width=60) (actual time=0.012..0.013 rows=1 loops=1)

10. 0.012 0.012 ↑ 9.0 1 1

Seq Scan on reg_0000 b_8 (cost=0.00..1.09 rows=9 width=27) (actual time=0.011..0.012 rows=1 loops=1)

11.          

SubPlan (for Hash Join)

12. 66.909 66.909 ↑ 50.0 2 66,909

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.001..0.001 rows=2 loops=66,909)

13. 0.000 0.000 ↑ 1.0 1 66,909

Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=66,909)

14. 66.909 66.909 ↑ 100.0 1 66,909

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.001..0.001 rows=1 loops=66,909)

15. 0.000 0.000 ↑ 1.0 1 66,909

Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=66,909)

16. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.00..1.01 rows=1 width=4) (never executed)

17. 0.000 0.000 ↓ 0.0 0

Seq Scan on tab_cenario_fiscal_parametros c (cost=0.00..1.01 rows=1 width=4) (never executed)

Planning time : 2.870 ms