| Limit (cost=49.65..49.65 rows=1 width=495) |
| -> Sort (cost=49.65..49.65 rows=1 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=49.63..49.64 rows=1 width=495) |
| Group Key: s.id |
| -> Sort (cost=49.63..49.63 rows=1 width=475) |
| Sort Key: s.id |
| -> Hash Right Join (cost=13.60..49.62 rows=1 width=475) |
| Hash Cond: (ccr.schedule_id = s.id) |
| Filter: (((s.created_by = ANY ('{5493,5495}'::integer[])) OR (ccr.user_id = 5495)) AND (((s.is_public = 1) AND (s.created_by <> 5495)) OR (s.created_by = 5495) OR (ccr.user_id = 5495))) |
| -> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..30.40 rows=2040 width=8) |
| -> Hash (cost=11.60..11.60 rows=160 width=475) |
| -> Seq Scan on tbl_schedules s (cost=0.00..11.60 rows=160 width=475) |