Sort (cost=5938.25..5938.52 rows=106 width=483) |
Sort Key: p.created_at DESC |
-> HashAggregate (cost=1745.83..5934.69 rows=106 width=483) |
Group Key: p.id |
-> Merge Right Join (cost=696.36..1730.37 rows=1237 width=371) |
Merge Cond: (sl.project_id = p.id) |
-> Index Scan using tbl_work_logs_project_id_idx on tbl_work_logs sl (cost=0.29..6120.49 rows=34624 width=12) |
-> Sort (cost=696.07..696.33 rows=106 width=363) |
Sort Key: p.id |
-> Nested Loop Left Join (cost=131.21..692.50 rows=106 width=363) |
-> Hash Left Join (cost=130.92..306.30 rows=106 width=359) |
Hash Cond: (p.client_id = c.id) |
-> Seq Scan on tbl_projects p (cost=0.00..175.10 rows=106 width=355) |
Filter: (creator = 1001) |
-> Hash (cost=106.52..106.52 rows=1952 width=4) |
-> Seq Scan on tbl_clients c (cost=0.00..106.52 rows=1952 width=4) |
-> Index Scan using tbl_work_logs_client_id_idx on tbl_work_logs arrive (cost=0.29..3.63 rows=1 width=12) |
Index Cond: ((client_id = c.id) AND (client_id IS NOT NULL)) |
Filter: ((NOT is_draft) AND (location_in_id IS NOT NULL) AND (location_out_id IS NOT NULL) AND (scenario_id = 1)) |
SubPlan 1 |
-> Aggregate (cost=39.45..39.46 rows=1 width=32) |
-> Seq Scan on tbl_invoices i (cost=0.00..39.45 rows=1 width=6) |
Filter: (project_id = p.id) |