Sort (cost=9914.88..9915.41 rows=212 width=486) |
Sort Key: p.created_at DESC |
-> HashAggregate (cost=2125.23..9906.69 rows=212 width=486) |
Group Key: p.id |
-> Merge Right Join (cost=1081.62..2093.44 rows=2543 width=374) |
Merge Cond: (sl.project_id = p.id) |
-> Index Scan using tbl_work_logs_project_id_idx on tbl_work_logs sl (cost=0.29..5952.71 rows=33645 width=12) |
-> Sort (cost=1081.33..1081.86 rows=212 width=366) |
Sort Key: p.id |
-> Nested Loop Left Join (cost=128.72..1073.14 rows=212 width=366) |
-> Hash Left Join (cost=128.44..299.05 rows=212 width=362) |
Hash Cond: (p.client_id = c.id) |
-> Seq Scan on tbl_projects p (cost=0.00..170.06 rows=212 width=358) |
Filter: (creator = 1004) |
-> Hash (cost=104.86..104.86 rows=1886 width=4) |
-> Seq Scan on tbl_clients c (cost=0.00..104.86 rows=1886 width=4) |
-> Index Scan using tbl_work_logs_client_id_idx on tbl_work_logs arrive (cost=0.29..3.64 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=36.64..36.65 rows=1 width=32) |
-> Seq Scan on tbl_invoices i (cost=0.00..36.64 rows=1 width=6) |
Filter: (project_id = p.id) |