QUERY PLAN
Sort (cost=170.49..170.54 rows=23 width=42)
Sort Key: pc.serial_no
-> Group (cost=169.79..169.97 rows=23 width=42)
Group Key: pc.id, pcr.project_id
-> Sort (cost=169.79..169.85 rows=23 width=23)
Sort Key: pc.id, pcr.project_id
-> Hash Join (cost=70.35..169.27 rows=23 width=23)
Hash Cond: (pc.id = pcr.contract_id)
-> Seq Scan on tbl_purchase_contracts pc (cost=0.00..76.45 rows=2224 width=19)
Filter: (cost_type = 1)
-> Hash (cost=70.05..70.05 rows=24 width=8)
-> Seq Scan on tbl_purchase_client_rels pcr (cost=0.00..70.05 rows=24 width=8)
Filter: (project_id = ANY ('{4172,4170,4168,4144,4167,4157,4128,4139,4127,4113,4112,4027,4017,3018}'::integer[]))