QUERY PLAN
Aggregate (cost=44.36..44.37 rows=1 width=8)
-> Group (cost=44.29..44.35 rows=1 width=479)
Group Key: s.id
-> Sort (cost=44.29..44.32 rows=13 width=4)
Sort Key: s.id
-> Hash Right Join (cost=8.18..44.05 rows=13 width=4)
Hash Cond: (ccr.schedule_id = s.id)
-> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..30.40 rows=2040 width=4)
-> Hash (cost=8.17..8.17 rows=1 width=12)
-> Index Scan using tbl_schedules_client_id_idx on tbl_schedules s (cost=0.14..8.17 rows=1 width=12)
Index Cond: (client_id = 1)
Filter: ((set_top_at IS NULL) AND (NOT is_complete) AND (end_at <= now()))