QUERY PLAN
Aggregate (cost=655.73..655.74 rows=1 width=8)
-> Group (cost=652.71..653.57 rows=173 width=479)
Group Key: s.id
-> Sort (cost=652.71..653.14 rows=173 width=4)
Sort Key: s.id
-> Hash Left Join (cost=19.55..646.28 rows=173 width=4)
Hash Cond: (s.id = ccr.schedule_id)
Filter: ((((s.is_public = 1) AND (s.created_by <> 1001)) OR (s.created_by = 1001) OR (ccr.user_id = 1001)) AND ((s.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1017,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5300,5311,5332,5360,5388,5446,5449}'::integer[])) OR (ccr.user_id = 1001)))
-> Seq Scan on tbl_schedules s (cost=0.00..624.34 rows=271 width=16)
Filter: ((set_top_at IS NULL) AND (NOT is_complete) AND (end_at <= now()))
-> Hash (cost=10.91..10.91 rows=691 width=8)
-> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..10.91 rows=691 width=8)