explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wodQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.014 183,221.561 ↑ 1.0 200 1

Limit (cost=5,910,059.34..5,910,059.84 rows=200 width=432) (actual time=183,221.539..183,221.561 rows=200 loops=1)

2. 18,859.841 183,221.547 ↑ 203,583.2 200 1

Sort (cost=5,910,059.34..6,011,850.93 rows=40,716,636 width=432) (actual time=183,221.538..183,221.547 rows=200 loops=1)

  • Sort Key: appointments."time" DESC
  • Sort Method: top-N heapsort Memory: 157kB
3. 97,809.139 164,361.706 ↓ 1.0 40,758,481 1

GroupAggregate (cost=0.99..4,150,315.61 rows=40,716,636 width=432) (actual time=0.061..164,361.706 rows=40,758,481 loops=1)

  • Group Key: appointments.id
4. 25,972.675 66,552.567 ↓ 1.0 40,908,025 1

Merge Left Join (cost=0.99..3,335,982.89 rows=40,716,636 width=408) (actual time=0.042..66,552.567 rows=40,908,025 loops=1)

  • Merge Cond: (appointments.id = ua.appointment_id)
5. 40,013.895 40,013.895 ↓ 1.0 40,758,481 1

Index Scan Backward using appointments_reverse_id_idx on appointments (cost=0.56..3,169,160.68 rows=40,716,636 width=400) (actual time=0.014..40,013.895 rows=40,758,481 loops=1)

6. 565.997 565.997 ↓ 1.0 641,140 1

Index Scan using user_appointments_appointment_id_user_role_deleted_at_idx on user_appointments ua (cost=0.42..57,181.48 rows=636,113 width=12) (actual time=0.024..565.997 rows=641,140 loops=1)

  • Index Cond: (((user_role)::text = 'secondary'::text) AND (deleted_at IS NULL))
Planning time : 1.881 ms
Execution time : 183,221.770 ms