explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qof7

Settings
# exclusive inclusive rows x rows loops node
1. 0.051 535.310 ↓ 3.5 7 1

GroupAggregate (cost=16,190.18..16,190.22 rows=2 width=28) (actual time=535.251..535.310 rows=7 loops=1)

  • Group Key: email_history.object_id
2. 0.267 535.259 ↓ 142.0 284 1

Sort (cost=16,190.18..16,190.18 rows=2 width=6) (actual time=535.238..535.259 rows=284 loops=1)

  • Sort Key: email_history.object_id
  • Sort Method: quicksort Memory: 38kB
3. 0.186 534.992 ↓ 142.0 284 1

Nested Loop (cost=1,567.37..16,190.17 rows=2 width=6) (actual time=19.975..534.992 rows=284 loops=1)

4. 0.052 11.294 ↑ 2.5 12 1

HashAggregate (cost=1,566.81..1,567.11 rows=30 width=4) (actual time=11.251..11.294 rows=12 loops=1)

  • Group Key: hub_auto_messages.id
5. 0.020 11.242 ↑ 2.5 12 1

Sort (cost=1,566.36..1,566.44 rows=30 width=4) (actual time=11.241..11.242 rows=12 loops=1)

  • Sort Key: hub_auto_messages.id DESC
  • Sort Method: quicksort Memory: 25kB
6. 11.222 11.222 ↑ 2.5 12 1

Seq Scan on hub_auto_messages (cost=0.00..1,565.62 rows=30 width=4) (actual time=4.771..11.222 rows=12 loops=1)

  • Filter: ((hub_id = 271) OR is_default)
  • Rows Removed by Filter: 7375
7. 523.512 523.512 ↓ 24.0 24 12

Index Scan using email_history_object_id_idx on email_history (cost=0.56..487.43 rows=1 width=6) (actual time=8.171..43.626 rows=24 loops=12)

  • Index Cond: ((object_type = 'HubAutoMessage'::text) AND (object_id = hub_auto_messages.id))
  • Filter: (hub_id = 271)
  • Rows Removed by Filter: 19206
Planning time : 1.371 ms
Execution time : 535.485 ms