explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sMwp

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

Sort (cost=697,904.91..697,921.86 rows=33,892 width=195) (actual rows= loops=)

  • Sort Key: ((date_range.date)::date) DESC
2.          

CTE base_row_by_sku

3. 0.000 0.000 ↓ 0.0

Unique (cost=173,915.83..174,003.64 rows=61,066 width=103) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=173,915.83..173,959.73 rows=87,812 width=103) (actual rows= loops=)

  • Sort Key: daily_product_metrics_ongoing_totals.sku, daily_product_metrics_ongoing_totals.date DESC
5. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on daily_product_metrics_ongoing_totals (cost=2,283.97..172,473.77 rows=87,812 width=103) (actual rows= loops=)

  • Recheck Cond: (((seller_id)::text = 'A1LMQBEOGTEVAC'::text) AND ((marketplace_id)::text = 'ATVPDKIKX0DER'::text) AND (date >= '2019-04-10 00:00:00'::timestamp without time zone) AND (date <= '2019-06-08 00:00:00'::timestamp without time zone))
6. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on dpm_ongoing_totals__sellerid__marketplaceid__date__parent_asin (cost=0.00..2,279.58 rows=87,812 width=0) (actual rows= loops=)

  • Index Cond: (((seller_id)::text = 'A1LMQBEOGTEVAC'::text) AND ((marketplace_id)::text = 'ATVPDKIKX0DER'::text) AND (date >= '2019-04-10 00:00:00'::timestamp without time zone) AND (date <= '2019-06-08 00:00:00'::timestamp without time zone))
7. 0.000 0.000 ↓ 0.0

WindowAgg (cost=522,865.92..523,391.24 rows=33,892 width=195) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Sort (cost=522,865.92..522,882.86 rows=33,892 width=172) (actual rows= loops=)

  • Sort Key: p.sku, ((date_range.date)::date)
9. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=509,064.29..522,355.89 rows=33,892 width=172) (actual rows= loops=)

  • Hash Cond: ((p.sku)::text = (base_row.sku)::text)
10. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=508,484.16..521,504.23 rows=111 width=88) (actual rows= loops=)

  • Join Filter: (dpc.date = date_range.date)
11.          

CTE date_range

12. 0.000 0.000 ↓ 0.0

Function Scan on generate_series (cost=0.00..3.00 rows=1,000 width=8) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Nested Loop (cost=508,481.05..521,047.18 rows=111 width=63) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Merge Join (cost=508,481.05..521,038.53 rows=22 width=55) (actual rows= loops=)

  • Merge Cond: ((p.sku)::text = (daily_product_costs.sku)::text)
15. 0.000 0.000 ↓ 0.0

Index Scan using products_seller_marketplace_isvalid_sku_id_idx on products p (cost=0.11..12,345.42 rows=6,106 width=55) (actual rows= loops=)

  • Index Cond: (((seller_id)::text = 'A1LMQBEOGTEVAC'::text) AND ((marketplace_id)::text = 'ATVPDKIKX0DER'::text) AND (is_valid = true))
  • Filter: is_valid
16. 0.000 0.000 ↓ 0.0

Sort (cost=508,480.93..508,585.46 rows=209,059 width=14) (actual rows= loops=)

  • Sort Key: daily_product_costs.sku
17. 0.000 0.000 ↓ 0.0

HashAggregate (cost=504,158.94..504,786.12 rows=209,059 width=14) (actual rows= loops=)

  • Group Key: (daily_product_costs.sku)::text
18. 0.000 0.000 ↓ 0.0

Seq Scan on daily_product_costs (cost=0.00..501,499.48 rows=5,318,928 width=14) (actual rows= loops=)

  • Filter: ((date >= '2019-06-09'::date) AND (date <= '2019-08-08'::date))
19. 0.000 0.000 ↓ 0.0

CTE Scan on date_range (cost=0.00..8.00 rows=5 width=8) (actual rows= loops=)

  • Filter: (((date)::date >= '2019-06-09'::date) AND ((date)::date <= '2019-08-08'::date))
20. 0.000 0.000 ↓ 0.0

Index Scan using daily_product_costs_pkey on daily_product_costs dpc (cost=0.11..4.09 rows=1 width=47) (actual rows= loops=)

  • Index Cond: (((seller_id)::text = 'A1LMQBEOGTEVAC'::text) AND ((marketplace_id)::text = 'ATVPDKIKX0DER'::text) AND ((sku)::text = (p.sku)::text))
21. 0.000 0.000 ↓ 0.0

Hash (cost=366.40..366.40 rows=61,066 width=116) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

CTE Scan on base_row_by_sku base_row (cost=0.00..366.40 rows=61,066 width=116) (actual rows= loops=)