QUERY PLAN
Aggregate (cost=1057.18..1057.19 rows=1 width=8)
-> Sort (cost=1052.86..1053.58 rows=288 width=167)
Sort Key: s.is_draft DESC, s.end_at DESC
-> HashAggregate (cost=1038.21..1041.09 rows=288 width=167)
Group Key: s.id
-> Hash Right Join (cost=857.02..1037.49 rows=288 width=13)
Hash Cond: (ccr.work_log_id = s.id)
-> Seq Scan on tbl_work_log_carbon_copy_rels ccr (cost=0.00..144.60 rows=9360 width=4)
-> Hash (cost=853.42..853.42 rows=288 width=13)
-> Hash Right Join (cost=708.85..853.42 rows=288 width=13)
Hash Cond: (rvr.work_log_id = s.id)
-> Seq Scan on tbl_work_log_verify_rels rvr (cost=0.00..123.66 rows=7966 width=4)
-> Hash (cost=705.25..705.25 rows=288 width=25)
-> Bitmap Heap Scan on tbl_work_logs s (cost=6.52..705.25 rows=288 width=25)
Recheck Cond: (client_id = 518)
Filter: (NOT is_draft)
-> Bitmap Index Scan on tbl_work_logs_client_id_idx (cost=0.00..6.45 rows=288 width=0)
Index Cond: (client_id = 518)