| Aggregate (cost=35.73..35.74 rows=1 width=8) |
| -> Sort (cost=35.65..35.66 rows=5 width=495) |
| Sort Key: s.set_top_at DESC NULLS LAST, (CASE WHEN s.is_complete THEN 3 WHEN ((NOT s.is_complete) AND (s.end_at <= now())) THEN 2 ELSE 1 END), (CASE WHEN s.is_complete THEN s.complete_at ELSE NULL::timestamp with time zone END) DESC, (CASE WHEN (NOT s.is_complete) THEN s.end_at ELSE NULL::timestamp with time zone END), s.created_at DESC |
| -> Group (cost=35.54..35.59 rows=5 width=495) |
| Group Key: s.id |
| -> Sort (cost=35.54..35.55 rows=5 width=37) |
| Sort Key: s.id |
| -> Hash Right Join (cost=22.80..35.48 rows=5 width=37) |
| Hash Cond: (ccr.schedule_id = s.id) |
| -> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..10.88 rows=688 width=4) |
| -> Hash (cost=22.74..22.74 rows=5 width=45) |
| -> Bitmap Heap Scan on tbl_schedules s (cost=4.32..22.74 rows=5 width=45) |
| Recheck Cond: (client_id = 1956) |
| -> Bitmap Index Scan on tbl_schedules_client_id_idx (cost=0.00..4.32 rows=5 width=0) |
| Index Cond: (client_id = 1956) |