| Aggregate (cost=249.33..249.34 rows=1 width=8) |
| -> Sort (cost=249.31..249.32 rows=1 width=826) |
| Sort Key: p.bargain_date DESC, p.created_at DESC |
| -> GroupAggregate (cost=212.30..249.30 rows=1 width=826) |
| Group Key: p.id |
| -> Nested Loop Left Join (cost=212.30..249.09 rows=80 width=16) |
| Join Filter: (egr.engineer_id = pa.engineer_id) |
| -> Merge Left Join (cost=212.30..212.37 rows=8 width=20) |
| Merge Cond: (p.id = ttr2.object_id) |
| -> Sort (cost=195.65..195.67 rows=8 width=20) |
| Sort Key: p.id |
| -> Hash Join (cost=146.17..195.53 rows=8 width=20) |
| Hash Cond: (p.id = pa.project_id) |
| -> Hash Join (cost=125.12..173.66 rows=209 width=16) |
| Hash Cond: (p.client_id = c.id) |
| Join Filter: ((c.sales_rep IS NULL) OR (c.sales_rep = 5493) OR (prr.user_id = 5495) OR (hashed SubPlan 1)) |
| -> Hash Right Join (cost=38.92..85.03 rows=78 width=24) |
| Hash Cond: (prr.project_id = p.id) |
| -> Seq Scan on tbl_project_remind_receivers prr (cost=0.00..30.40 rows=2040 width=8) |
| -> Hash (cost=38.87..38.87 rows=4 width=20) |
| -> Nested Loop Left Join (cost=8.48..38.87 rows=4 width=20) |
| -> Nested Loop Left Join (cost=4.31..29.35 rows=1 width=20) |
| -> Nested Loop Left Join (cost=4.16..21.17 rows=1 width=20) |
| -> Seq Scan on tbl_projects p (cost=0.00..11.65 rows=1 width=24) |
| Filter: ((budget <= collected) AND (project_status = 3)) |
| -> Bitmap Heap Scan on tbl_work_logs arrive (cost=4.16..9.51 rows=1 width=4) |
| Recheck Cond: (project_id = p.id) |
| 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)) |
| -> Bitmap Index Scan on tbl_work_logs_project_id_idx (cost=0.00..4.16 rows=2 width=0) |
| Index Cond: (project_id = p.id) |
| -> Index Only Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships ttr (cost=0.15..8.17 rows=1 width=4) |
| Index Cond: ((object_id = p.id) AND (term_id = 10)) |
| -> Bitmap Heap Scan on tbl_work_logs sl (cost=4.16..9.50 rows=2 width=4) |
| Recheck Cond: (project_id = p.id) |
| -> Bitmap Index Scan on tbl_work_logs_project_id_idx (cost=0.00..4.16 rows=2 width=0) |
| Index Cond: (project_id = p.id) |
| -> Hash (cost=49.39..49.39 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)) |
| SubPlan 1 |
| -> Seq Scan on tbl_user_visit_clients (cost=0.00..35.50 rows=10 width=4) |
| Filter: (user_id = 5495) |
| -> Hash (cost=21.00..21.00 rows=4 width=8) |
| -> Seq Scan on tbl_project_architects pa (cost=0.00..21.00 rows=4 width=8) |
| Filter: (engineer_id = 5495) |
| -> Sort (cost=16.65..16.66 rows=3 width=4) |
| Sort Key: ttr2.object_id |
| -> Seq Scan on tbl_term_taxonomy_relationships ttr2 (cost=0.00..16.62 rows=3 width=4) |
| Filter: (term_id = 13) |
| -> Materialize (cost=0.00..35.55 rows=10 width=4) |
| -> Seq Scan on tbl_engineer_group_relationships egr (cost=0.00..35.50 rows=10 width=4) |
| Filter: (engineer_id = 5495) |