QUERY PLAN
Aggregate (cost=212.38..212.39 rows=1 width=32)
-> Hash Join (cost=144.19..212.30 rows=33 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=143.45..143.45 rows=59 width=4)
-> Bitmap Heap Scan on tbl_projects p (cost=5.12..143.45 rows=59 width=4)
Recheck Cond: (created_by = 1001)
Filter: (project_status = 3)
-> Bitmap Index Scan on tbl_projects_created_by_idx (cost=0.00..5.11 rows=110 width=0)
Index Cond: (created_by = 1001)