QUERY PLAN
Sort (cost=167.76..167.81 rows=22 width=42)
Sort Key: pc.serial_no
-> Group (cost=167.10..167.27 rows=22 width=42)
Group Key: pc.id, pcr.project_id
-> Sort (cost=167.10..167.16 rows=22 width=23)
Sort Key: pc.id, pcr.project_id
-> Hash Join (cost=67.70..166.61 rows=22 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=67.41..67.41 rows=23 width=8)
-> Seq Scan on tbl_purchase_client_rels pcr (cost=0.00..67.41 rows=23 width=8)
Filter: (project_id = ANY ('{3854,4167,4174,4139,4142,4113,4112,4077,4161,4151,4169,4084,4155}'::integer[]))