| Sort (cost=7226.32..7226.60 rows=113 width=477) |
| Sort Key: p.created_at DESC |
| -> HashAggregate (cost=2285.21..7222.46 rows=113 width=477) |
| Group Key: p.id |
| -> Merge Right Join (cost=1232.53..2269.26 rows=1276 width=365) |
| Merge Cond: (sl.project_id = p.id) |
| -> Index Scan using tbl_work_logs_project_id_idx on tbl_work_logs sl (cost=0.29..6291.82 rows=35731 width=12) |
| -> Sort (cost=1232.24..1232.52 rows=113 width=357) |
| Sort Key: p.id |
| -> Merge Right Join (cost=189.69..1228.39 rows=113 width=357) |
| Merge Cond: (arrive.project_id = p.id) |
| -> Index Scan using tbl_work_logs_project_id_idx on tbl_work_logs arrive (cost=0.29..6381.15 rows=209 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=189.40..189.69 rows=113 width=349) |
| Sort Key: p.id |
| -> Seq Scan on tbl_projects p (cost=0.00..185.55 rows=113 width=349) |
| Filter: (creator = 1001) |
| SubPlan 1 |
| -> Aggregate (cost=43.63..43.64 rows=1 width=32) |
| -> Seq Scan on tbl_invoices i (cost=0.00..43.62 rows=1 width=6) |
| Filter: (project_id = p.id) |