explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lYA4

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 65,734.695 ↓ 0.0 0 1

Limit (cost=9,504.10..11,090.50 rows=80 width=16) (actual time=65,734.695..65,734.695 rows=0 loops=1)

2. 0.004 65,734.693 ↓ 0.0 0 1

Nested Loop (cost=9,504.10..1,674,454.29 rows=83,961 width=16) (actual time=65,734.693..65,734.693 rows=0 loops=1)

3. 0.031 0.031 ↑ 1.0 1 1

Index Scan using classes_pkey on classes c (cost=0.28..2.30 rows=1 width=16) (actual time=0.025..0.031 rows=1 loops=1)

  • Index Cond: (id = '96e95f37-93b6-453c-800d-c8f3d3e29e28'::uuid)
  • Filter: ("deletedAt" IS NULL)
4. 7,189.815 65,734.658 ↓ 0.0 0 1

Hash Join (cost=9,503.82..1,673,612.38 rows=83,961 width=32) (actual time=65,734.658..65,734.658 rows=0 loops=1)

  • Hash Cond: (s."recipientId" = recipient.id)
5. 57,043.045 57,043.045 ↑ 1.0 12,037,139 1

Seq Scan on smses s (cost=0.00..1,477,878.72 rows=12,359,349 width=32) (actual time=0.012..57,043.045 rows=12,037,139 loops=1)

  • 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: 7955239
6. 8.441 1,501.798 ↓ 1.2 12,662 1

Hash (cost=9,376.87..9,376.87 rows=10,156 width=32) (actual time=1,501.798..1,501.798 rows=12,662 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 792kB
7. 1,400.659 1,493.357 ↓ 1.2 12,662 1

Bitmap Heap Scan on users recipient (cost=204.92..9,376.87 rows=10,156 width=32) (actual time=93.285..1,493.357 rows=12,662 loops=1)

  • Recheck Cond: (("classId" = '96e95f37-93b6-453c-800d-c8f3d3e29e28'::uuid) AND ("deletedAt" IS NULL) AND ("deactivatedAt" IS NULL))
8. 92.698 92.698 ↓ 1.2 12,662 1

Bitmap Index Scan on users_class_id_deleted_at_deactivated_at (cost=0.00..202.38 rows=10,156 width=0) (actual time=92.698..92.698 rows=12,662 loops=1)

  • Index Cond: (("classId" = '96e95f37-93b6-453c-800d-c8f3d3e29e28'::uuid) AND ("deletedAt" IS NULL) AND ("deactivatedAt" IS NULL))