explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yvtbr

Settings
# exclusive inclusive rows x rows loops node
1. 0.299 239.239 ↑ 45.4 400 1

GroupAggregate (cost=495,713.44..516,147.06 rows=18,158 width=72) (actual time=238.953..239.239 rows=400 loops=1)

  • Group Key: s.category_id, s.customer_id
2. 0.142 238.940 ↑ 4,032.2 400 1

Sort (cost=495,713.44..499,745.69 rows=1,612,900 width=22) (actual time=238.930..238.940 rows=400 loops=1)

  • Sort Key: s.category_id, s.customer_id
  • Sort Method: quicksort Memory: 56kB
3. 14.862 238.798 ↑ 4,032.2 400 1

Merge Right Join (cost=231,121.76..263,256.57 rows=1,612,900 width=22) (actual time=200.985..238.798 rows=400 loops=1)

  • Merge Cond: ((s.category_id = ca.category_id) AND (s.customer_id = cu.customer_id))
4. 196.491 223.622 ↑ 1.0 175,751 1

Sort (cost=22,558.56..23,012.52 rows=181,585 width=22) (actual time=198.334..223.622 rows=175,751 loops=1)

  • Sort Key: s.category_id, s.customer_id
  • Sort Method: external merge Disk: 5864kB
5. 27.131 27.131 ↑ 1.0 181,585 1

Seq Scan on sales_m s (cost=0.00..2,972.85 rows=181,585 width=22) (actual time=0.020..27.131 rows=181,585 loops=1)

6. 0.055 0.314 ↑ 4,032.2 400 1

Materialize (cost=208,563.20..216,627.70 rows=1,612,900 width=8) (actual time=0.209..0.314 rows=400 loops=1)

7. 0.157 0.259 ↑ 4,032.2 400 1

Sort (cost=208,563.20..212,595.45 rows=1,612,900 width=8) (actual time=0.202..0.259 rows=400 loops=1)

  • Sort Key: ca.category_id, cu.customer_id
  • Sort Method: quicksort Memory: 43kB
8. 0.033 0.102 ↑ 4,032.2 400 1

Nested Loop (cost=0.00..20,209.83 rows=1,612,900 width=8) (actual time=0.045..0.102 rows=400 loops=1)

9. 0.029 0.029 ↑ 63.5 20 1

Seq Scan on top20customers_m cu (cost=0.00..22.70 rows=1,270 width=4) (actual time=0.028..0.029 rows=20 loops=1)

10. 0.023 0.040 ↑ 63.5 20 20

Materialize (cost=0.00..29.05 rows=1,270 width=4) (actual time=0.001..0.002 rows=20 loops=20)

11. 0.017 0.017 ↑ 63.5 20 1

Seq Scan on top20cats_m ca (cost=0.00..22.70 rows=1,270 width=4) (actual time=0.013..0.017 rows=20 loops=1)