QUERY PLAN
Aggregate (cost=265.40..265.41 rows=1 width=32)
-> Nested Loop (cost=161.67..265.16 rows=95 width=6)
-> Hash Join (cost=161.39..234.27 rows=81 width=4)
Hash Cond: (c.project_id = p.id)
-> Seq Scan on tbl_sales_contracts c (cost=0.00..68.32 rows=1732 width=8)
-> Hash (cost=159.54..159.54 rows=148 width=4)
-> Bitmap Heap Scan on tbl_projects p (cost=5.43..159.54 rows=148 width=4)
Recheck Cond: (created_by = 1001)
-> Bitmap Index Scan on tbl_projects_created_by_idx (cost=0.00..5.39 rows=148 width=0)
Index Cond: (created_by = 1001)
-> Index Scan using tbl_sales_contract_invoices_contract_id_idx on tbl_sales_contract_invoices sci (cost=0.28..0.37 rows=1 width=10)
Index Cond: (contract_id = c.id)