explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GhQm

Settings
# exclusive inclusive rows x rows loops node
1. 6.369 1,321.690 ↑ 1.0 1 1

Aggregate (cost=110,764.64..110,764.65 rows=1 width=16) (actual time=1,321.690..1,321.690 rows=1 loops=1)

2. 219.792 1,315.321 ↓ 66.8 104,913 1

Hash Join (cost=61,088.58..110,760.71 rows=1,570 width=16) (actual time=892.094..1,315.321 rows=104,913 loops=1)

  • Hash Cond: (s."recipientId" = recipient.id)
3. 215.560 257.402 ↑ 1.8 110,182 1

Bitmap Heap Scan on smses s (cost=4,729.20..53,641.63 rows=198,399 width=32) (actual time=44.124..257.402 rows=110,182 loops=1)

  • Recheck Cond: (((status)::text = 'Queued'::text) OR ((status)::text = 'Failed'::text))
  • Rows Removed by Index Recheck: 15605
  • Filter: (("deletedAt" IS NULL) AND (("toBeSentAt" IS NULL) OR ("toBeSentAt" <= now())) AND (((status)::text = 'Queued'::text) OR (((status)::text = 'Failed'::text) AND (attempts < 5))))
  • Rows Removed by Filter: 160249
4. 0.001 41.842 ↓ 0.0 0 1

BitmapOr (cost=4,729.20..4,729.20 rows=234,286 width=0) (actual time=41.842..41.842 rows=0 loops=1)

5. 41.811 41.811 ↓ 1.4 331,605 1

Bitmap Index Scan on smses_status_idx (cost=0.00..4,625.02 rows=234,213 width=0) (actual time=41.811..41.811 rows=331,605 loops=1)

  • Index Cond: ((status)::text = 'Queued'::text)
6. 0.030 0.030 ↓ 1.1 77 1

Bitmap Index Scan on smses_status_idx (cost=0.00..4.98 rows=73 width=0) (actual time=0.030..0.030 rows=77 loops=1)

  • Index Cond: ((status)::text = 'Failed'::text)
7. 198.213 838.127 ↓ 93.4 1,090,408 1

Hash (cost=56,213.44..56,213.44 rows=11,675 width=16) (actual time=838.127..838.127 rows=1,090,408 loops=1)

  • Buckets: 2048 Batches: 64 (originally 1) Memory Usage: 1025kB
8. 313.365 639.914 ↓ 93.4 1,090,408 1

Hash Join (cost=312.67..56,213.44 rows=11,675 width=16) (actual time=9.076..639.914 rows=1,090,408 loops=1)

  • Hash Cond: (recipient."classId" = c.id)
9. 317.765 317.765 ↓ 1.0 1,325,414 1

Seq Scan on users recipient (cost=0.00..51,033.54 rows=1,267,435 width=32) (actual time=0.275..317.765 rows=1,325,414 loops=1)

  • Filter: (("deletedAt" IS NULL) AND ("deactivatedAt" IS NULL))
  • Rows Removed by Filter: 149741
10. 0.161 8.784 ↓ 15.9 302 1

Hash (cost=312.43..312.43 rows=19 width=16) (actual time=8.784..8.784 rows=302 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 15kB
11. 0.335 8.623 ↓ 15.9 302 1

Hash Join (cost=227.91..312.43 rows=19 width=16) (actual time=6.378..8.623 rows=302 loops=1)

  • Hash Cond: (c."schoolId" = sch.id)
12. 2.166 2.166 ↑ 1.0 339 1

Seq Scan on classes c (cost=0.00..83.06 rows=339 width=32) (actual time=0.243..2.166 rows=339 loops=1)

  • Filter: ("deletedAt" IS NULL)
  • Rows Removed by Filter: 1767
13. 0.040 6.122 ↑ 1.0 101 1

Hash (cost=226.65..226.65 rows=101 width=16) (actual time=6.122..6.122 rows=101 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 5kB
14. 6.082 6.082 ↑ 1.0 101 1

Seq Scan on schools sch (cost=0.00..226.65 rows=101 width=16) (actual time=0.210..6.082 rows=101 loops=1)

  • Filter: ("deletedAt" IS NULL)
  • Rows Removed by Filter: 1664