| Aggregate (cost=21.75..21.76 rows=1 width=8) |
| -> Sort (cost=21.73..21.73 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=21.71..21.72 rows=1 width=495) |
| Group Key: s.id |
| -> Sort (cost=21.71..21.71 rows=1 width=37) |
| Sort Key: s.id |
| -> Hash Right Join (cost=9.00..21.70 rows=1 width=37) |
| Hash Cond: (ccr.schedule_id = s.id) |
| -> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..10.89 rows=689 width=4) |
| -> Hash (cost=8.98..8.98 rows=1 width=45) |
| -> Index Scan using tbl_schedules_project_id_idx on tbl_schedules s (cost=0.29..8.98 rows=1 width=45) |
| Index Cond: (project_id = 4184) |
| Filter: ((set_top_at IS NOT NULL) AND (created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5300,5311,5332,5360,5446,5461,5476,5499,5500}'::integer[]))) |