explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lpsf

Settings
# exclusive inclusive rows x rows loops node
1. 137.777 60,741.573 ↑ 4.6 50,000 1

Group (cost=49,644.79..76,052,585.54 rows=227,900 width=284) (actual time=35.007..60,741.573 rows=50,000 loops=1)

  • Group Key: c.customer_id, p.product_id
2. 43.877 53.796 ↑ 4.6 50,000 1

Sort (cost=49,644.79..50,214.54 rows=227,900 width=244) (actual time=32.455..53.796 rows=50,000 loops=1)

  • Sort Key: c.customer_id, p.product_id
  • Sort Method: external merge Disk: 2184kB
3. 6.669 9.919 ↑ 4.6 50,000 1

Nested Loop (cost=0.00..2,879.43 rows=227,900 width=244) (actual time=0.053..9.919 rows=50,000 loops=1)

4. 0.250 0.250 ↓ 1.9 1,000 1

Seq Scan on customer c (cost=0.00..15.30 rows=530 width=122) (actual time=0.022..0.250 rows=1,000 loops=1)

5. 2.978 3.000 ↑ 8.6 50 1,000

Materialize (cost=0.00..16.45 rows=430 width=122) (actual time=0.000..0.003 rows=50 loops=1,000)

6. 0.022 0.022 ↑ 8.6 50 1

Seq Scan on product p (cost=0.00..14.30 rows=430 width=122) (actual time=0.015..0.022 rows=50 loops=1)

7.          

SubPlan (forGroup)

8. 150.000 30,200.000 ↑ 1.0 1 50,000

Aggregate (cost=166.72..166.73 rows=1 width=8) (actual time=0.604..0.604 rows=1 loops=50,000)

9. 30,050.000 30,050.000 ↓ 0.0 0 50,000

Seq Scan on sale s (cost=0.00..166.72 rows=1 width=4) (actual time=0.545..0.601 rows=0 loops=50,000)

  • Filter: ((customer_id = c.customer_id) AND (product_id = p.product_id))
  • Rows Removed by Filter: 10000
10. 200.000 30,350.000 ↑ 1.0 1 50,000

Aggregate (cost=166.74..166.75 rows=1 width=32) (actual time=0.607..0.607 rows=1 loops=50,000)

11. 30,150.000 30,150.000 ↓ 0.0 0 50,000

Seq Scan on sale s_1 (cost=0.00..166.72 rows=1 width=36) (actual time=0.547..0.603 rows=0 loops=50,000)

  • Filter: ((customer_id = c.customer_id) AND (product_id = p.product_id))
  • Rows Removed by Filter: 10000