| Limit (cost=256.19..256.20 rows=2 width=362) |
| -> Sort (cost=256.19..256.20 rows=2 width=362) |
| Sort Key: p.bargain_date DESC, p.created_at DESC |
| -> Nested Loop Left Join (cost=169.52..256.18 rows=2 width=362) |
| -> Nested Loop (cost=169.24..255.08 rows=2 width=362) |
| -> Hash Join (cost=168.96..182.56 rows=55 width=12) |
| Hash Cond: ((min(subpsl.id)) = minpsl.id) |
| -> HashAggregate (cost=91.42..97.43 rows=601 width=12) |
| Group Key: subpsl.project_id |
| Filter: ((min(subpsl.id) IS NOT NULL) AND (max(subpsl.id) IS NOT NULL)) |
| -> Seq Scan on tbl_project_status_logs subpsl (cost=0.00..82.79 rows=690 width=8) |
| Filter: ((created_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (created_at < '2026-01-01 00:00:00'::timestamp without time zone)) |
| -> Hash (cost=73.16..73.16 rows=350 width=8) |
| -> Seq Scan on tbl_project_status_logs minpsl (cost=0.00..73.16 rows=350 width=8) |
| Filter: ((old_status IS NULL) AND (new_status = '3'::smallint)) |
| -> Index Scan using tbl_projects_pkey on tbl_projects p (cost=0.28..1.32 rows=1 width=354) |
| Index Cond: (id = subpsl.project_id) |
| Filter: (created_by = 1001) |
| -> Index Scan using tbl_project_status_logs_pkey on tbl_project_status_logs maxpsl (cost=0.28..0.55 rows=1 width=8) |
| Index Cond: ((max(subpsl.id)) = id) |