explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3FgJ

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

Group (cost=306,417.87..306,417.94 rows=4 width=12) (actual rows= loops=)

  • Group Key: (to_date(to_char((sdc.dt_sale)::timestamp with time zone, 'YYYY-MM-01'::text), 'YYYY-MM-DD'::text)), sto.id_store_type, pro.co_product
2. 0.000 0.000 ↓ 0.0

Sort (cost=306,417.87..306,417.88 rows=4 width=12) (actual rows= loops=)

  • Sort Key: (to_date(to_char((sdc.dt_sale)::timestamp with time zone, 'YYYY-MM-01'::text), 'YYYY-MM-DD'::text)), sto.id_store_type, pro.co_product
3. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,000.99..306,417.83 rows=4 width=12) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1,000.56..306,416.87 rows=1 width=22) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Index Only Scan using idx_cos_f_cost_vig_co_product_dt_begin_dt_end on cos_f_cost_vig cos (cost=0.42..0.89 rows=4 width=14) (actual rows= loops=)

  • Join Filter: ((sdl.dt_sale >= tax.dt_begin) AND (sdl.dt_sale <= COALESCE((tax.dt_end)::timestamp with time zone, now())))
  • Index Cond: ((co_product = (sdl.co_product)::text) AND (dt_begin <= sdl.dt_sale))
  • Filter: (sdl.dt_sale <= COALESCE((dt_end)::timestamp with time zone, now()))
6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1,000.43..306,416.70 rows=1 width=24) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Index Scan using idx_com_d_tax_his_id_tax_dt_begin on com_d_tax_his tax (cost=0.13..0.15 rows=1 width=10) (actual rows= loops=)

  • Index Cond: (pro.id_tax = id_tax)
8. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1,000.14..306,416.05 rows=1 width=16) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Index Scan using pk01_pro_d_product on pro_d_product pro (cost=0.29..0.64 rows=1 width=8) (actual rows= loops=)

  • Index Cond: ((co_product)::text = (sdl.co_product)::text)
  • Filter: (co_section IS NOT NULL)
10. 0.000 0.000 ↓ 0.0

Index Scan using pk01_sto_d_store on sto_d_store sto (cost=0.14..0.16 rows=1 width=4) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Gather (cost=1,000.00..306,415.88 rows=1 width=18) (actual rows= loops=)

  • Workers Planned: 3
  • Index Cond: (id_store = sdc.id_store)
12. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..305,415.78 rows=1 width=18) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Append (cost=0.00..14,218.72 rows=267,316 width=34) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Append (cost=0.00..1.07 rows=2 width=26) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Seq Scan on sal_f_sales_det_lin sdl (cost=0.00..0.00 rows=1 width=44) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on sal_f_sales_det_cab_202004 sdc_1 (cost=0.00..14,218.72 rows=267,315 width=34) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on sal_f_sales_det_cab sdc (cost=0.00..0.00 rows=1 width=64) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Index Scan using idx04_sal_f_sales_det_lin_202004 on sal_f_sales_det_lin_202004 sdl_1 (cost=0.56..1.07 rows=1 width=26) (actual rows= loops=)

  • Index Cond: ((dt_sale = sdc.dt_sale) AND (dt_sale >= '2020-04-01'::date) AND (dt_sale <= '2020-04-30'::date) AND (ti_hour = sdc.ti_hour) AND (id_store = sdc.id_store) AND (id_cash = sdc.id_cash) AND (id_tpv = sdc.id_tpv) AND (id_ticket = sdc.id_ticket))
  • Filter: ((dt_sale >= '2020-04-01'::date) AND (dt_sale <= '2020-04-30'::date))
  • Filter: ((dt_sale >= '2020-04-01'::date) AND (dt_sale <= '2020-04-30'::date))
  • Filter: ((dt_sale >= '2020-04-01'::date) AND (dt_sale <= '2020-04-30'::date) AND ((co_product)::text <> '00000'::text) AND ((co_product)::text <> '00019'::text) AND (sdc.dt_sale = dt_sale) AND (sdc.id_store = id_store) AND (sdc.ti_hour = ti_hour) AND (sdc.id_cash = id_cash) AND (sdc.id_tpv = id_tpv) AND (sdc.id_ticket = id_ticket))
  • Filter: (((co_product)::text <> '00000'::text) AND ((co_product)::text <> '00019'::text))