QUERY PLAN
Aggregate (cost=930.35..930.36 rows=1 width=8)
-> HashAggregate (cost=715.41..810.94 rows=9553 width=479)
Group Key: s.id
-> Hash Left Join (cost=18.51..691.53 rows=9553 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,5296,5300,5311,5329,5332,5360,5388,5404,5420,5440,5445,5446}'::integer[])) OR (ccr.user_id = 1001)))
-> Seq Scan on tbl_schedules s (cost=0.00..546.17 rows=14228 width=16)
Filter: ((set_top_at IS NULL) AND is_complete)
-> 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)