Sort (cost=124.10..124.10 rows=1 width=199) |
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=111.94..124.09 rows=1 width=199) |
Hash Cond: (ccr.schedule_id = s.id) |
Filter: (((s.is_public = 1) AND (s.created_by <> 5016)) OR (s.created_by = 5016) OR (ccr.user_id = 5016)) |
-> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..10.45 rows=645 width=8) |
-> Hash (cost=111.93..111.93 rows=1 width=183) |
-> Index Scan using tbl_schedules_project_id_idx on tbl_schedules s (cost=0.29..111.93 rows=1 width=183) |
Index Cond: (project_id = ANY ('{3809,3461,3796,3801,3800,3793,3794,3792,3788,3786,3782,3785,3783,3780,3684,3547,3755,3694,3720,3743}'::integer[])) |
Filter: ((NOT is_complete) OR (complete_at >= '2025-06-20 00:00:00+08'::timestamp with time zone)) |