| Limit (cost=40102.18..40523.83 rows=20 width=826) |
| -> Result (cost=40102.18..42421.25 rows=110 width=826) |
| -> Sort (cost=40102.18..40102.45 rows=110 width=794) |
| Sort Key: p.bargain_date DESC NULLS LAST, p.created_at DESC |
| -> GroupAggregate (cost=1121.61..40099.25 rows=110 width=794) |
| Group Key: p.id |
| -> Merge Left Join (cost=1121.61..17109.26 rows=1838693 width=682) |
| Merge Cond: (p.id = pa.project_id) |
| -> Merge Left Join (cost=188.83..950.94 rows=22533 width=682) |
| Merge Cond: (p.id = ttr2.object_id) |
| -> Merge Left Join (cost=188.68..865.38 rows=22533 width=682) |
| Merge Cond: (p.id = sl.project_id) |
| -> Merge Left Join (cost=188.53..614.82 rows=5508 width=674) |
| Merge Cond: (p.id = prr.project_id) |
| Filter: ((c.sales_rep IS NULL) OR (c.sales_rep = 5493) OR (prr.user_id = 5495) OR (hashed SubPlan 2)) |
| -> Nested Loop (cost=10.47..306.60 rows=561 width=682) |
| Join Filter: (c.id = p.client_id) |
| -> Nested Loop Left Join (cost=0.14..88.65 rows=110 width=674) |
| Join Filter: (ttr.object_id = p.id) |
| -> Nested Loop Left Join (cost=0.14..67.07 rows=110 width=674) |
| Join Filter: (arrive.project_id = p.id) |
| -> Index Scan using tbl_projects_pkey on tbl_projects p (cost=0.14..49.79 rows=110 width=666) |
| -> Materialize (cost=0.00..15.63 rows=1 width=12) |
| -> Seq Scan on tbl_work_logs arrive (cost=0.00..15.62 rows=1 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)) |
| -> Materialize (cost=0.00..16.64 rows=3 width=4) |
| -> Seq Scan on tbl_term_taxonomy_relationships ttr (cost=0.00..16.62 rows=3 width=4) |
| Filter: (term_id = 10) |
| -> Materialize (cost=10.32..49.90 rows=102 width=8) |
| -> Hash Right Join (cost=10.32..49.39 rows=102 width=8) |
| Hash Cond: (sgr.sales_id = c.sales_rep) |
| -> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..30.40 rows=2040 width=4) |
| -> Hash (cost=10.20..10.20 rows=10 width=8) |
| -> Seq Scan on tbl_clients c (cost=0.00..10.20 rows=10 width=8) |
| Filter: ((NOT deleted) AND (id IS NOT NULL)) |
| -> Sort (cost=142.54..147.64 rows=2040 width=8) |
| Sort Key: prr.project_id |
| -> Seq Scan on tbl_project_remind_receivers prr (cost=0.00..30.40 rows=2040 width=8) |
| SubPlan 2 |
| -> Seq Scan on tbl_user_visit_clients (cost=0.00..35.50 rows=10 width=4) |
| Filter: (user_id = 5495) |
| -> Materialize (cost=0.15..52.02 rows=450 width=12) |
| -> Index Scan using tbl_work_logs_project_id_idx on tbl_work_logs sl (cost=0.15..50.90 rows=450 width=12) |
| -> Materialize (cost=0.15..24.16 rows=3 width=4) |
| -> Index Only Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships ttr2 (cost=0.15..24.16 rows=3 width=4) |
| Index Cond: (term_id = 13) |
| -> Sort (cost=932.78..955.22 rows=8976 width=4) |
| Sort Key: pa.project_id |
| -> Merge Left Join (cost=204.38..343.42 rows=8976 width=4) |
| Merge Cond: (pa.engineer_id = egr.engineer_id) |
| -> Sort (cost=61.84..64.04 rows=880 width=8) |
| Sort Key: pa.engineer_id |
| -> Seq Scan on tbl_project_architects pa (cost=0.00..18.80 rows=880 width=8) |
| -> Sort (cost=142.54..147.64 rows=2040 width=4) |
| Sort Key: egr.engineer_id |
| -> Seq Scan on tbl_engineer_group_relationships egr (cost=0.00..30.40 rows=2040 width=4) |
| SubPlan 1 |
| -> Aggregate (cost=21.01..21.02 rows=1 width=32) |
| -> Seq Scan on tbl_invoices i (cost=0.00..21.00 rows=4 width=32) |
| Filter: (project_id = p.id) |