explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HKtq

Settings
# exclusive inclusive rows x rows loops node
1. 0.372 69.768 ↑ 1.0 1,000 1

Limit (cost=34,171.10..34,173.60 rows=1,000 width=477) (actual time=69.115..69.768 rows=1,000 loops=1)

2. 51.231 69.396 ↑ 22.9 1,000 1

Sort (cost=34,171.10..34,228.32 rows=22,889 width=477) (actual time=69.112..69.396 rows=1,000 loops=1)

  • Sort Key: modified_at, id
  • Sort Method: top-N heapsort Memory: 1,653kB
3. 13.268 18.165 ↑ 1.2 19,771 1

Bitmap Heap Scan on notifications (cost=3,227.73..32,916.12 rows=22,889 width=477) (actual time=5.841..18.165 rows=19,771 loops=1)

  • Recheck Cond: (((modified_at > '2020-03-23 00:57:39.930224+00'::timestamp with time zone) AND (sent_at IS NOT NULL)) OR ((datetime > (now() + '01:00:00'::interval)) AND (sent_at IS NULL)))
  • Filter: (((modified_at > '2020-03-23 00:57:39.930224+00'::timestamp with time zone) AND (sent_at IS NOT NULL) AND (migration_status <> 'migrated and scheduled'::migration_status)) OR ((datetime > (now() + '01:00:00'::interval)) AND (sent_at IS NULL) AND (migration_status = 'local'::migration_status)))
  • Rows Removed by Filter: 5
  • Heap Blocks: exact=3,636
4. 0.001 4.897 ↓ 0.0 0 1

BitmapOr (cost=3,227.73..3,227.73 rows=22,895 width=0) (actual time=4.897..4.897 rows=0 loops=1)

5. 4.855 4.855 ↑ 1.2 19,428 1

Bitmap Index Scan on notifications_modified_at_id_idx (cost=0.00..3,212.10 rows=22,891 width=0) (actual time=4.854..4.855 rows=19,428 loops=1)

  • Index Cond: (modified_at > '2020-03-23 00:57:39.930224+00'::timestamp with time zone)
6. 0.041 0.041 ↓ 87.0 348 1

Bitmap Index Scan on notifications_unsent_idx (cost=0.00..4.18 rows=4 width=0) (actual time=0.040..0.041 rows=348 loops=1)

  • Index Cond: (datetime > (now() + '01:00:00'::interval))