explain.depesz.com

PostgreSQL's explain analyze made readable

Result: pvaF

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

Hash Right Join (cost=58,768.23..59,831.16 rows=12,113 width=175) (actual rows= loops=)

  • Hash Cond: ((dpc.sku)::text = (p.sku)::text)
  • Join Filter: (dpc.date = date_range.date)
2.          

CTE skus_with_sales_or_advertising

3. 0.000 0.000 ↓ 0.0

Hash Join (cost=169.24..13,205.44 rows=5,292 width=14) (actual rows= loops=)

  • Hash Cond: (p_2.tm_id = pfs.tm_product_id)
4. 0.000 0.000 ↓ 0.0

Seq Scan on products p_2 (cost=0.00..12,653.99 rows=145,599 width=30) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Hash (cost=103.09..103.09 rows=5,292 width=16) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Seq Scan on product_firsts pfs (cost=0.00..103.09 rows=5,292 width=16) (actual rows= loops=)

  • Filter: ((cost_data_first_set_at IS NOT NULL) OR (ad_data_first_set_at IS NOT NULL))
7.          

CTE date_range

8. 0.000 0.000 ↓ 0.0

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

9. 0.000 0.000 ↓ 0.0

Seq Scan on daily_product_costs dpc (cost=0.00..896.07 rows=28,507 width=51) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Hash (cost=45,401.36..45,401.36 rows=12,113 width=150) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Merge Join (cost=45,214.64..45,401.36 rows=12,113 width=150) (actual rows= loops=)

  • Merge Cond: (date_range.date = pf.date)
12. 0.000 0.000 ↓ 0.0

Sort (cost=69.83..72.33 rows=1,000 width=8) (actual rows= loops=)

  • Sort Key: date_range.date
13. 0.000 0.000 ↓ 0.0

CTE Scan on date_range (cost=0.00..20.00 rows=1,000 width=8) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Sort (cost=45,144.81..45,150.87 rows=2,423 width=146) (actual rows= loops=)

  • Sort Key: pf.date
15. 0.000 0.000 ↓ 0.0

Hash Join (cost=33,555.04..45,008.60 rows=2,423 width=146) (actual rows= loops=)

  • Hash Cond: ((pa.sku)::text = (p.sku)::text)
16. 0.000 0.000 ↓ 0.0

Finalize GroupAggregate (cost=16,120.04..26,594.14 rows=69,471 width=171) (actual rows= loops=)

  • Group Key: m.seller_id, p_1.marketplace_id, pf.date, pa.sku
17. 0.000 0.000 ↓ 0.0

Gather Merge (cost=16,120.04..23,960.05 rows=57,892 width=171) (actual rows= loops=)

  • Workers Planned: 2
18. 0.000 0.000 ↓ 0.0

Partial GroupAggregate (cost=15,120.01..16,277.85 rows=28,946 width=171) (actual rows= loops=)

  • Group Key: m.seller_id, p_1.marketplace_id, pf.date, pa.sku
19. 0.000 0.000 ↓ 0.0

Sort (cost=15,120.01..15,192.38 rows=28,946 width=101) (actual rows= loops=)

  • Sort Key: m.seller_id, p_1.marketplace_id, pf.date, pa.sku
20. 0.000 0.000 ↓ 0.0

Hash Join (cost=3,829.74..12,974.96 rows=28,946 width=101) (actual rows= loops=)

  • Hash Cond: (p_1.merchant_id = m.id)
21. 0.000 0.000 ↓ 0.0

Hash Join (cost=3,803.54..12,872.33 rows=28,946 width=77) (actual rows= loops=)

  • Hash Cond: (pa.profile_id = p_1.id)
22. 0.000 0.000 ↓ 0.0

Parallel Hash Join (cost=3,787.47..12,779.08 rows=28,946 width=45) (actual rows= loops=)

  • Hash Cond: (pa.id = pf.product_ad_id)
23. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on product_ads pa (cost=0.00..6,208.13 rows=160,813 width=31) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Parallel Hash (cost=3,276.65..3,276.65 rows=40,865 width=30) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Parallel Seq Scan on daily_product_ad_performances pf (cost=0.00..3,276.65 rows=40,865 width=30) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Hash (cost=12.70..12.70 rows=270 width=48) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Seq Scan on profiles p_1 (cost=0.00..12.70 rows=270 width=48) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Hash (cost=17.20..17.20 rows=720 width=36) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Seq Scan on merchants m (cost=0.00..17.20 rows=720 width=36) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Hash (cost=17,371.59..17,371.59 rows=5,073 width=86) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Hash Join (cost=15,759.18..17,371.59 rows=5,073 width=86) (actual rows= loops=)

  • Hash Cond: ((skus_with_sales_or_advertising.sku)::text = (p.sku)::text)
32. 0.000 0.000 ↓ 0.0

CTE Scan on skus_with_sales_or_advertising (cost=0.00..105.84 rows=5,292 width=32) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Hash (cost=12,653.99..12,653.99 rows=139,455 width=54) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Seq Scan on products p (cost=0.00..12,653.99 rows=139,455 width=54) (actual rows= loops=)

  • Filter: is_valid