Limit (cost=332.77..332.78 rows=3 width=539) |
-> Sort (cost=332.77..332.78 rows=3 width=539) |
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=332.72..332.75 rows=3 width=539) |
Group Key: s.id |
-> Sort (cost=332.72..332.72 rows=3 width=519) |
Sort Key: s.id |
-> Hash Right Join (cost=319.97..332.69 rows=3 width=519) |
Hash Cond: (ccr.schedule_id = s.id) |
-> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..10.91 rows=691 width=4) |
-> Hash (cost=319.93..319.93 rows=3 width=519) |
-> Bitmap Heap Scan on tbl_schedules s (cost=5.54..319.93 rows=3 width=519) |
Recheck Cond: (created_by = 5016) |
Filter: (NOT is_complete) |
-> Bitmap Index Scan on tbl_schedules_created_by_idx (cost=0.00..5.54 rows=167 width=0) |
Index Cond: (created_by = 5016) |