explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xo2X

Settings
# exclusive inclusive rows x rows loops node
1. 0.283 114.067 ↑ 45.4 400 1

GroupAggregate (cost=482,056.45..502,490.07 rows=18,158 width=72) (actual time=113.781..114.067 rows=400 loops=1)

  • Group Key: s.category_id, s.customer_id
2. 0.170 113.784 ↑ 4,032.2 400 1

Sort (cost=482,056.45..486,088.70 rows=1,612,900 width=22) (actual time=113.772..113.784 rows=400 loops=1)

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

Merge Right Join (cost=208,563.62..249,599.57 rows=1,612,900 width=22) (actual time=9.724..113.614 rows=400 loops=1)

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

Index Scan using customer_category_idx on sales_m s (cost=0.42..9,355.53 rows=181,585 width=22) (actual time=0.094..100.238 rows=175,751 loops=1)

5. 0.046 0.283 ↑ 4,032.2 400 1

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

6. 0.171 0.237 ↑ 4,032.2 400 1

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

  • Sort Key: ca.category_id, cu.customer_id
  • Sort Method: quicksort Memory: 43kB
7. 0.035 0.066 ↑ 4,032.2 400 1

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

8. 0.011 0.011 ↑ 63.5 20 1

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

9. 0.010 0.020 ↑ 63.5 20 20

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

10. 0.010 0.010 ↑ 63.5 20 1

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