| Aggregate (cost=124.06..124.07 rows=1 width=8) |
| -> Unique (cost=119.64..123.64 rows=34 width=784) |
| -> Sort (cost=119.64..119.73 rows=34 width=784) |
| Sort Key: s.sales_date DESC, s.created_at DESC, s.id, s.sales_order_id, s.product_id, s.parent, s.sn, s.supplier_id, s."order", s.created_by, s.updated_at, s.pn, s.product_type, s.product_component, s.product_brand, s.product_serie, s.product_misc, s.hardware_from, s.software_from, s.maintenance_from, s.hardware_to, s.software_to, s.maintenance_to, s.new_hardware_deadline, s.new_software_deadline, s.new_maintenance_deadline, s.client_id, s.project_id, s.sales_rep, s.description, s.software_reminded, s.hardware_reminded, s.maintenance_reminded, s.software_advance_reminded, s.hardware_advance_reminded, s.maintenance_advance_reminded, s.is_system, s.amount, s.cost, s.is_renew, s.renew_to_sales_order_item_id, s.number, s.is_merge, s.need_sn, s.erp_sales_outbound_id, s.erp_sales_gift_id |
| -> Group (cost=118.61..118.78 rows=34 width=784) |
| Group Key: s.id |
| -> Sort (cost=118.61..118.69 rows=34 width=784) |
| Sort Key: s.id |
| -> Hash Right Join (cost=79.38..117.74 rows=34 width=784) |
| Hash Cond: (sgr.sales_id = client.sales_rep) |
| -> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..30.40 rows=2040 width=4) |
| -> Hash (cost=79.35..79.35 rows=3 width=788) |
| -> Hash Join (cost=58.14..79.35 rows=3 width=788) |
| Hash Cond: (s.client_id = client.id) |
| -> Hash Right Join (cost=12.25..33.42 rows=13 width=784) |
| Hash Cond: (log.sales_order_item_id = s.id) |
| Filter: ((s.project_id = 1) OR (log.project_id = 1)) |
| -> Seq Scan on tbl_sales_order_item_renew_logs log (cost=0.00..18.80 rows=880 width=8) |
| -> Hash (cost=11.00..11.00 rows=100 width=784) |
| -> Seq Scan on tbl_sales_order_items s (cost=0.00..11.00 rows=100 width=784) |
| -> Hash (cost=45.82..45.82 rows=5 width=8) |
| -> Seq Scan on tbl_clients client (cost=35.52..45.82 rows=5 width=8) |
| Filter: ((NOT deleted) AND ((sales_rep = 5493) OR (sales_rep IS NULL) OR (hashed SubPlan 1))) |
| SubPlan 1 |
| -> Seq Scan on tbl_user_visit_clients (cost=0.00..35.50 rows=10 width=4) |
| Filter: (user_id = 5495) |