QUERY PLAN
Aggregate (cost=134.56..134.57 rows=1 width=8)
-> Group (cost=133.92..134.10 rows=37 width=479)
Group Key: s.id
-> Sort (cost=133.92..134.01 rows=37 width=4)
Sort Key: s.id
-> Hash Right Join (cost=120.25..132.95 rows=37 width=4)
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=119.79..119.79 rows=37 width=12)
-> Bitmap Heap Scan on tbl_schedules s (cost=4.58..119.79 rows=37 width=12)
Recheck Cond: (client_id = 982)
Filter: ((set_top_at IS NULL) AND is_complete)
-> Bitmap Index Scan on tbl_schedules_client_id_idx (cost=0.00..4.57 rows=38 width=0)
Index Cond: (client_id = 982)