| Aggregate (cost=924.21..924.22 rows=1 width=8) |
| -> Sort (cost=924.18..924.18 rows=2 width=1766) |
| Sort Key: "*SELECT* 1".start_at DESC, "*SELECT* 1".ticket_id DESC |
| -> Result (cost=0.56..924.17 rows=2 width=1766) |
| -> Append (cost=0.56..924.15 rows=2 width=60) |
| -> Subquery Scan on "*SELECT* 1" (cost=0.56..246.04 rows=1 width=60) |
| -> Nested Loop Left Join (cost=0.56..246.03 rows=1 width=280) |
| -> Nested Loop (cost=0.29..237.73 rows=1 width=28) |
| -> Seq Scan on tbl_pre_sales p (cost=0.00..96.45 rows=19 width=24) |
| Filter: ((start_at IS NOT NULL) AND ((NOT is_draft) OR (is_draft IS NULL)) AND (start_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (start_at <= '2026-12-31 23:59:59+08'::timestamp with time zone)) |
| -> Index Scan using tbl_cases_pkey on tbl_cases c (cost=0.29..7.25 rows=1 width=12) |
| Index Cond: (id = p.case_id) |
| Filter: (project_id = 4173) |
| -> Index Scan using tbl_clients_pkey on tbl_clients cl (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (id = COALESCE(p.client_id, c.client_id)) |
| -> Subquery Scan on "*SELECT* 2" (cost=0.28..678.11 rows=1 width=60) |
| -> Nested Loop Left Join (cost=0.28..678.10 rows=1 width=280) |
| -> Nested Loop (cost=0.00..669.79 rows=1 width=28) |
| Join Filter: (i.case_id = c_1.id) |
| -> Seq Scan on tbl_implement_records i (cost=0.00..375.42 rows=132 width=20) |
| Filter: ((arrived_at IS NOT NULL) AND ((NOT is_draft) OR (is_draft IS NULL)) AND (arrived_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (arrived_at <= '2026-12-31 23:59:59+08'::timestamp with time zone)) |
| -> Materialize (cost=0.00..288.44 rows=3 width=16) |
| -> Seq Scan on tbl_cases c_1 (cost=0.00..288.43 rows=3 width=16) |
| Filter: (project_id = 4173) |
| -> Index Scan using tbl_clients_pkey on tbl_clients cl_1 (cost=0.28..8.29 rows=1 width=8) |
| Index Cond: (id = COALESCE(i.client_id, c_1.client_id)) |