Limit (cost=638.16..638.18 rows=10 width=540) |
-> Sort (cost=638.16..639.37 rows=484 width=540) |
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 |
-> HashAggregate (cost=620.44..627.70 rows=484 width=540) |
Group Key: s.id |
-> Hash Left Join (cost=26.35..619.23 rows=484 width=520) |
Hash Cond: (s.id = ccr.schedule_id) |
Filter: ((((s.is_public = 1) AND (s.created_by <> 1000)) OR (s.created_by = 1000) OR (ccr.user_id = 1000)) AND ((s.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1017,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5296,5300,5311,5329,5332,5360,5388,5404,5420,5440,5445,5446}'::integer[])) OR (ccr.user_id = 1000))) |
-> Hash Join (cost=7.84..593.27 rows=836 width=520) |
Hash Cond: (s.created_by = u.id) |
-> Seq Scan on tbl_schedules s (cost=0.00..546.17 rows=14517 width=520) |
-> Hash (cost=7.74..7.74 rows=8 width=4) |
-> Seq Scan on tbl_users u (cost=0.00..7.74 rows=8 width=4) |
Filter: (department_id = 9) |
-> Hash (cost=10.45..10.45 rows=645 width=8) |
-> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..10.45 rows=645 width=8) |