explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TMKY

Settings
# exclusive inclusive rows x rows loops node
1. 1.986 90,915.945 ↓ 1.2 707 1

Sort (cost=1,881,773.56..1,881,775.00 rows=577 width=1,627) (actual time=90,915.833..90,915.945 rows=707 loops=1)

  • Sort Key: hub_manual_messages.scheduled_time DESC
  • Sort Method: quicksort Memory: 946kB
2. 3.984 90,913.959 ↓ 1.2 707 1

WindowAgg (cost=1,878,839.17..1,881,747.10 rows=577 width=1,627) (actual time=90,912.936..90,913.959 rows=707 loops=1)

3. 2.336 90,909.975 ↓ 1.2 707 1

Hash Right Join (cost=1,878,839.17..1,881,739.88 rows=577 width=1,611) (actual time=90,468.838..90,909.975 rows=707 loops=1)

  • Hash Cond: (a.object_id = hub_manual_messages.id)
4. 0.000 90,325.062 ↑ 2.0 2,108 1

Finalize GroupAggregate (cost=1,877,570.55..1,880,419.21 rows=4,123 width=44) (actual time=89,886.184..90,325.062 rows=2,108 loops=1)

  • Group Key: a.object_id
5. 0.000 91,106.366 ↑ 1.8 4,556 1

Gather Merge (cost=1,877,570.55..1,880,254.29 rows=8,246 width=44) (actual time=89,886.161..91,106.366 rows=4,556 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 729.315 270,021.063 ↑ 2.7 1,519 3

Partial GroupAggregate (cost=1,876,570.52..1,878,302.47 rows=4,123 width=44) (actual time=89,641.929..90,007.021 rows=1,519 loops=3)

  • Group Key: a.object_id
7. 2,034.750 269,291.748 ↓ 4.2 356,318 3

Sort (cost=1,876,570.52..1,876,781.86 rows=84,536 width=72) (actual time=89,641.902..89,763.916 rows=356,318 loops=3)

  • Sort Key: a.object_id
  • Sort Method: external merge Disk: 24424kB
  • Worker 0: Sort Method: external merge Disk: 33592kB
  • Worker 1: Sort Method: external merge Disk: 26664kB
8. 59,793.855 267,256.998 ↓ 4.2 356,318 3

Parallel Hash Join (cost=1,049,707.94..1,866,183.90 rows=84,536 width=72) (actual time=87,561.082..89,085.666 rows=356,318 loops=3)

  • Hash Cond: (a.user_id = users.id)
9. 139,136.301 139,136.301 ↑ 1.3 2,483,520 3

Parallel Seq Scan on email_history a (cost=0.00..730,402.69 rows=3,124,542 width=68) (actual time=0.857..46,378.767 rows=2,483,520 loops=3)

  • Filter: (object_type = 'HubManualMessage'::text)
  • Rows Removed by Filter: 1606719
10. 280.962 68,326.842 ↑ 1.2 130,088 3

Parallel Hash (cost=1,046,960.59..1,046,960.59 rows=158,028 width=16) (actual time=22,775.613..22,775.614 rows=130,088 loops=3)

  • Buckets: 131072 Batches: 8 Memory Usage: 3680kB
11. 3,421.179 68,045.880 ↑ 1.2 130,088 3

Parallel Hash Join (cost=277,982.43..1,046,960.59 rows=158,028 width=16) (actual time=22,258.698..22,681.960 rows=130,088 loops=3)

  • Hash Cond: (users.id = user_hubs.user_id)
12. 15,449.436 15,449.436 ↑ 3.6 1,593,363 3

Parallel Seq Scan on users (cost=0.00..708,523.50 rows=5,716,440 width=4) (actual time=0.087..5,149.812 rows=1,593,363 loops=3)

  • Filter: (deleted_at IS NULL)
  • Rows Removed by Filter: 32585
13. 898.935 49,175.265 ↑ 1.2 130,088 3

Parallel Hash (cost=275,175.09..275,175.09 rows=161,467 width=12) (actual time=16,391.754..16,391.755 rows=130,088 loops=3)

  • Buckets: 131072 Batches: 8 Memory Usage: 3360kB
14. 48,276.330 48,276.330 ↑ 1.2 130,088 3

Parallel Seq Scan on user_hubs (cost=0.00..275,175.09 rows=161,467 width=12) (actual time=615.621..16,092.110 rows=130,088 loops=3)

  • Filter: ((deleted_at IS NULL) AND (hub_id = 39))
  • Rows Removed by Filter: 1582168
15. 1.137 582.577 ↓ 1.2 707 1

Hash (cost=1,261.41..1,261.41 rows=577 width=1,567) (actual time=582.577..582.577 rows=707 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 659kB
16. 566.023 581.440 ↓ 1.2 707 1

Bitmap Heap Scan on hub_manual_messages (cost=30.04..1,261.41 rows=577 width=1,567) (actual time=18.490..581.440 rows=707 loops=1)

  • Recheck Cond: (hub_id = 39)
  • Filter: ((NOT is_deleted) AND (status <> 'draft'::text) AND ((type <> 'scheduledFuture'::text) OR (status <> 'pending'::text)) AND ((type <> 'scheduledCurrent'::text) OR (scheduled_time <= now())))
  • Rows Removed by Filter: 41
  • Heap Blocks: exact=529
17. 15.417 15.417 ↑ 1.0 748 1

Bitmap Index Scan on unique_name_hub (cost=0.00..29.89 rows=748 width=0) (actual time=15.417..15.417 rows=748 loops=1)

  • Index Cond: (hub_id = 39)