| Limit (cost=545.49..545.50 rows=5 width=183) |
| -> Sort (cost=545.49..545.50 rows=5 width=183) |
| Sort Key: r.created_at DESC |
| -> Append (cost=502.61..545.43 rows=5 width=183) |
| -> Group (cost=502.61..502.68 rows=1 width=143) |
| Group Key: r.id, sc.from_project |
| -> Merge Left Join (cost=502.61..502.67 rows=1 width=98) |
| Merge Cond: (r.id = cpc.erp_cash_cost_ticket_id) |
| Filter: (cpc.id IS NULL) |
| -> Sort (cost=501.53..501.55 rows=5 width=98) |
| Sort Key: r.id |
| -> Hash Join (cost=8.31..501.48 rows=5 width=98) |
| Hash Cond: (r.sales_contract_id = sc.id) |
| -> Seq Scan on tbl_erp_cash_cost_tickets r (cost=0.00..470.94 rows=8465 width=98) |
| Filter: (status = 2) |
| -> Hash (cost=8.29..8.29 rows=1 width=8) |
| -> Index Scan using tbl_sales_contracts_from_project_idx on tbl_sales_contracts sc (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (from_project = 4103) |
| -> Sort (cost=1.08..1.09 rows=4 width=8) |
| Sort Key: cpc.erp_cash_cost_ticket_id |
| -> Seq Scan on tbl_erp_cash_cost_ticket_client_project_costs cpc (cost=0.00..1.04 rows=4 width=8) |
| -> Subquery Scan on "*SELECT* 2" (cost=9.37..9.39 rows=1 width=143) |
| -> Group (cost=9.37..9.38 rows=1 width=147) |
| Group Key: cpc_1.id, r_1.id |
| -> Sort (cost=9.37..9.37 rows=1 width=102) |
| Sort Key: cpc_1.id, r_1.id |
| -> Nested Loop (cost=0.29..9.36 rows=1 width=102) |
| -> Seq Scan on tbl_erp_cash_cost_ticket_client_project_costs cpc_1 (cost=0.00..1.05 rows=1 width=21) |
| Filter: (project_id = 4103) |
| -> Index Scan using tbl_erp_cash_cost_tickets_pkey on tbl_erp_cash_cost_tickets r_1 (cost=0.29..8.30 rows=1 width=85) |
| Index Cond: (id = cpc_1.erp_cash_cost_ticket_id) |
| Filter: (status = 2) |
| -> Group (cost=2.89..2.91 rows=1 width=187) |
| Group Key: r_2.id |
| -> Sort (cost=2.89..2.90 rows=1 width=146) |
| Sort Key: r_2.id |
| -> Seq Scan on tbl_erp_cost_tickets r_2 (cost=0.00..2.88 rows=1 width=146) |
| Filter: ((status = 2) AND (project_id = 4103)) |
| -> Group (cost=9.57..9.59 rows=1 width=233) |
| Group Key: r_3.id, sc_1.from_project |
| -> Sort (cost=9.57..9.57 rows=1 width=188) |
| Sort Key: r_3.id |
| -> Nested Loop (cost=0.28..9.56 rows=1 width=188) |
| Join Filter: (r_3.sales_contract_id = sc_1.id) |
| -> Index Scan using tbl_sales_contracts_from_project_idx on tbl_sales_contracts sc_1 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (from_project = 4103) |
| -> Seq Scan on tbl_erp_cost_convert_tickets r_3 (cost=0.00..1.14 rows=10 width=188) |
| Filter: (status = 2) |
| -> GroupAggregate (cost=20.76..20.82 rows=1 width=208) |
| Group Key: r_4.id |
| -> Sort (cost=20.76..20.77 rows=3 width=109) |
| Sort Key: r_4.id |
| -> Hash Right Join (cost=6.59..20.74 rows=3 width=109) |
| Hash Cond: (eipss.erp_sales_gift_id = r_4.id) |
| -> Seq Scan on tbl_erp_inventory_product_spents eipss (cost=0.00..12.65 rows=565 width=14) |
| -> Hash (cost=6.58..6.58 rows=1 width=99) |
| -> Seq Scan on tbl_erp_sales_gifts r_4 (cost=0.00..6.58 rows=1 width=99) |
| Filter: ((project_id = 4103) AND (status = 2)) |