explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ChIO

Settings
# exclusive inclusive rows x rows loops node
1. 70.933 467.002 ↑ 70.6 75,955 1

Sort (cost=922,721.17..936,122.15 rows=5,360,392 width=20) (actual time=447.890..467.002 rows=75,955 loops=1)

  • Sort Key: a.last_seen_at DESC NULLS LAST
  • Sort Method: external merge Disk: 2064kB
2.          

CTE user_last_saved_listing_at

3. 8.165 9.153 ↓ 1.0 16,223 1

Bitmap Heap Scan on user_events (cost=366.13..2,339.90 rows=16,221 width=12) (actual time=1.182..9.153 rows=16,223 loops=1)

  • Recheck Cond: (event_type = 'saved_listing'::text)
  • Heap Blocks: exact=1716
4. 0.988 0.988 ↓ 1.0 16,223 1

Bitmap Index Scan on user_events_event_type_idx (cost=0.00..362.08 rows=16,221 width=0) (actual time=0.988..0.988 rows=16,223 loops=1)

  • Index Cond: (event_type = 'saved_listing'::text)
5.          

CTE user_last_seen_at

6. 92.418 205.113 ↓ 1.1 75,955 1

GroupAggregate (cost=0.42..12,830.82 rows=66,092 width=12) (actual time=0.019..205.113 rows=75,955 loops=1)

  • Group Key: user_events_1.user_id
7. 112.695 112.695 ↓ 1.0 214,758 1

Index Scan using user_events_user_id_idx on user_events user_events_1 (cost=0.42..11,096.14 rows=214,752 width=12) (actual time=0.011..112.695 rows=214,758 loops=1)

8. 40.365 396.069 ↑ 70.6 75,955 1

Merge Right Join (cost=8,071.95..88,558.93 rows=5,360,392 width=20) (actual time=332.008..396.069 rows=75,955 loops=1)

  • Merge Cond: (b.user_id = a.user_id)
9. 10.820 29.088 ↓ 1.0 16,223 1

Sort (cost=1,458.72..1,499.27 rows=16,221 width=12) (actual time=24.790..29.088 rows=16,223 loops=1)

  • Sort Key: b.user_id
  • Sort Method: quicksort Memory: 1145kB
10. 18.268 18.268 ↓ 1.0 16,223 1

CTE Scan on user_last_saved_listing_at b (cost=0.00..324.42 rows=16,221 width=12) (actual time=1.184..18.268 rows=16,223 loops=1)

11. 73.925 326.616 ↓ 1.1 75,955 1

Sort (cost=6,613.23..6,778.46 rows=66,092 width=12) (actual time=307.212..326.616 rows=75,955 loops=1)

  • Sort Key: a.user_id
  • Sort Method: external sort Disk: 2232kB
12. 252.691 252.691 ↓ 1.1 75,955 1

CTE Scan on user_last_seen_at a (cost=0.00..1,321.84 rows=66,092 width=12) (actual time=0.020..252.691 rows=75,955 loops=1)