QUERY PLAN
Aggregate (cost=308.02..308.03 rows=1 width=32)
-> Hash Join (cost=238.58..306.69 rows=533 width=6)
Hash Cond: (c.from_project = p.id)
-> Seq Scan on tbl_sales_contracts c (cost=0.00..63.71 rows=1671 width=10)
-> Hash (cost=226.57..226.57 rows=961 width=4)
-> Seq Scan on tbl_projects p (cost=0.00..226.57 rows=961 width=4)
Filter: ((project_status = 3) AND (created_by = ANY ('{1001,1004,1005,1013,5087,5295,5300,5311,5329,5332,5420,5448,5449}'::integer[])))