| Sort (cost=332.58..332.59 rows=2 width=198) |
| 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.end_at DESC |
| -> Hash Right Join (cost=319.88..332.57 rows=2 width=198) |
| Hash Cond: (ccr.schedule_id = s.id) |
| Filter: (((s.is_public = 1) AND (s.created_by <> 1001)) OR (s.created_by = 1001) OR (ccr.user_id = 1001)) |
| -> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..10.88 rows=688 width=8) |
| -> Hash (cost=319.85..319.85 rows=2 width=182) |
| -> Bitmap Heap Scan on tbl_schedules s (cost=74.45..319.85 rows=2 width=182) |
| Recheck Cond: (client_id = ANY ('{3461,3460,3458,3457,3456,3454,3452,3451,3450,3449,3448,3447,3446,3443,3438,3437,3436,3435,3434,3433}'::integer[])) |
| Filter: ((NOT is_complete) OR (complete_at >= '2026-05-19 00:00:00+08'::timestamp with time zone)) |
| -> Bitmap Index Scan on tbl_schedules_client_id_idx (cost=0.00..74.45 rows=105 width=0) |
| Index Cond: (client_id = ANY ('{3461,3460,3458,3457,3456,3454,3452,3451,3450,3449,3448,3447,3446,3443,3438,3437,3436,3435,3434,3433}'::integer[])) |