| Sort (cost=6603.05..6603.32 rows=106 width=482) |
| Sort Key: p.created_at DESC |
| -> HashAggregate (cost=2227.78..6599.48 rows=106 width=482) |
| Group Key: p.id |
| -> Merge Right Join (cost=1201.36..2212.59 rows=1215 width=370) |
| Merge Cond: (sl.project_id = p.id) |
| -> Index Scan using tbl_work_logs_project_id_idx on tbl_work_logs sl (cost=0.29..6158.63 rows=35024 width=12) |
| -> Sort (cost=1201.07..1201.34 rows=106 width=362) |
| Sort Key: p.id |
| -> Merge Right Join (cost=184.04..1197.51 rows=106 width=362) |
| Merge Cond: (arrive.project_id = p.id) |
| -> Index Scan using tbl_work_logs_project_id_idx on tbl_work_logs arrive (cost=0.29..6246.19 rows=185 width=12) |
| Filter: ((NOT is_draft) AND (location_in_id IS NOT NULL) AND (location_out_id IS NOT NULL) AND (client_id IS NOT NULL) AND (scenario_id = 1)) |
| -> Sort (cost=183.75..184.02 rows=106 width=354) |
| Sort Key: p.id |
| -> Seq Scan on tbl_projects p (cost=0.00..180.19 rows=106 width=354) |
| Filter: (creator = 1001) |
| SubPlan 1 |
| -> Aggregate (cost=41.18..41.19 rows=1 width=32) |
| -> Seq Scan on tbl_invoices i (cost=0.00..41.17 rows=1 width=6) |
| Filter: (project_id = p.id) |