| Aggregate (cost=121.73..121.74 rows=1 width=8) |
| -> Sort (cost=121.71..121.72 rows=1 width=495) |
| Sort Key: (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.end_at DESC |
| -> Group (cost=121.69..121.70 rows=1 width=495) |
| Group Key: s.id |
| -> Sort (cost=121.69..121.69 rows=1 width=21) |
| Sort Key: s.id |
| -> Hash Right Join (cost=108.99..121.68 rows=1 width=21) |
| 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=108.98..108.98 rows=1 width=29) |
| -> Bitmap Heap Scan on tbl_schedules s (cost=4.54..108.98 rows=1 width=29) |
| Recheck Cond: (created_by = 5064) |
| Filter: (NOT is_complete) |
| -> Bitmap Index Scan on tbl_schedules_created_by_idx (cost=0.00..4.54 rows=34 width=0) |
| Index Cond: (created_by = 5064) |