explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Tmp

Settings
# exclusive inclusive rows x rows loops node
1. 0.007 1,679.463 ↑ 1.0 80 1

Limit (cost=94,060.78..94,060.98 rows=80 width=24) (actual time=1,679.457..1,679.463 rows=80 loops=1)

2. 11.298 1,679.456 ↑ 3.5 80 1

Sort (cost=94,060.78..94,061.49 rows=283 width=24) (actual time=1,679.454..1,679.456 rows=80 loops=1)

  • Sort Key: s."createdAt
  • Sort Method: top-N heapsort Memory: 31kB
3. 114.598 1,668.158 ↓ 267.6 75,738 1

Hash Join (cost=44,391.24..94,050.42 rows=283 width=24) (actual time=860.443..1,668.158 rows=75,738 loops=1)

  • Hash Cond: (s."recipientId" = recipient.id)
4. 1,133.755 1,420.890 ↑ 1.8 110,050 1

Bitmap Heap Scan on smses s (cost=4,729.19..53,641.62 rows=198,379 width=40) (actual time=290.383..1,420.890 rows=110,050 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: 160381
5. 0.002 287.135 ↓ 0.0 0 1

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

6. 286.819 286.819 ↓ 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=286.819..286.819 rows=331,605 loops=1)

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

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

  • Index Cond: ((status)::text = 'Failed'::text)
8. 10.705 132.670 ↓ 20.1 42,417 1

Hash (cost=39,635.72..39,635.72 rows=2,106 width=16) (actual time=132.670..132.670 rows=42,417 loops=1)

  • Buckets: 1024 Batches: 2 (originally 1) Memory Usage: 1025kB
9. 4.702 121.965 ↓ 20.1 42,417 1

Nested Loop (cost=1,218.16..39,635.72 rows=2,106 width=16) (actual time=7.308..121.965 rows=42,417 loops=1)

10. 0.004 0.040 ↑ 1.0 1 1

Nested Loop (cost=0.56..16.61 rows=1 width=16) (actual time=0.036..0.040 rows=1 loops=1)

11. 0.028 0.028 ↑ 1.0 1 1

Index Scan using classes_pkey on classes c (cost=0.28..8.30 rows=1 width=32) (actual time=0.027..0.028 rows=1 loops=1)

  • Index Cond: (id = 'f5f8df6e-f9a1-4e96-a0dc-ff93047616f0'::uuid)
  • Filter: ("deletedAt" IS NULL)
12. 0.008 0.008 ↑ 1.0 1 1

Index Scan using schools_pkey on schools sch (cost=0.28..8.30 rows=1 width=16) (actual time=0.005..0.008 rows=1 loops=1)

  • Index Cond: (id = c."schoolId")
  • Filter: ("deletedAt" IS NULL)
13. 110.767 117.223 ↓ 1.2 42,417 1

Bitmap Heap Scan on users recipient (cost=1,217.60..39,251.14 rows=36,798 width=32) (actual time=7.266..117.223 rows=42,417 loops=1)

  • Recheck Cond: (("classId" = 'f5f8df6e-f9a1-4e96-a0dc-ff93047616f0'::uuid) AND ("deletedAt" IS NULL) AND ("deactivatedAt" IS NULL))
14. 6.456 6.456 ↓ 1.2 42,417 1

Bitmap Index Scan on users_class_id_deleted_at_deactivated_at (cost=0.00..1,208.40 rows=36,798 width=0) (actual time=6.456..6.456 rows=42,417 loops=1)

  • Index Cond: (("classId" = 'f5f8df6e-f9a1-4e96-a0dc-ff93047616f0'::uuid) AND ("deletedAt" IS NULL) AND ("deactivatedAt" IS NULL))