QUERY PLAN
Sort (cost=164.98..165.02 rows=16 width=42)
Sort Key: pc.serial_no
-> Group (cost=164.54..164.66 rows=16 width=42)
Group Key: pc.id, pcr.project_id
-> Sort (cost=164.54..164.58 rows=16 width=23)
Sort Key: pc.id, pcr.project_id
-> Nested Loop (cost=0.28..164.22 rows=16 width=23)
-> Seq Scan on tbl_purchase_client_rels pcr (cost=0.00..67.41 rows=16 width=8)
Filter: (project_id = ANY ('{3854,4174,4155,4172,4170,4151,4169,4168,4144,4167,4161,4157,4142}'::integer[]))
-> Index Scan using tbl_purchase_contracts_pkey on tbl_purchase_contracts pc (cost=0.28..6.05 rows=1 width=19)
Index Cond: (id = pcr.contract_id)
Filter: (cost_type = 1)