QUERY PLAN
GroupAggregate (cost=19.09..19.13 rows=2 width=36)
Group Key: "*SELECT* 1".id
-> Sort (cost=19.09..19.10 rows=2 width=10)
Sort Key: "*SELECT* 1".id
-> Append (cost=0.29..19.08 rows=2 width=10)
-> Subquery Scan on "*SELECT* 1" (cost=0.29..9.67 rows=1 width=10)
-> Nested Loop (cost=0.29..9.66 rows=1 width=18)
-> Seq Scan on tbl_erp_other_income_tickets r (cost=0.00..1.33 rows=1 width=4)
Filter: ((created_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2))
-> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt (cost=0.29..8.32 rows=1 width=14)
Index Cond: ((object_id = r.id) AND (term_id = 20))
Filter: ((object_type = 14) AND (taxonomy_id = ANY ('{399,400,401,402,430,431}'::integer[])))
-> Subquery Scan on "*SELECT* 2" (cost=0.29..9.41 rows=1 width=10)
-> Nested Loop (cost=0.29..9.40 rows=1 width=18)
-> Seq Scan on tbl_erp_cost_convert_tickets r_1 (cost=0.00..1.07 rows=1 width=4)
Filter: ((created_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND (status = 2))
-> Index Scan using tbl_term_taxonomy_relationships_object_id_term_id_idx on tbl_term_taxonomy_relationships dt_1 (cost=0.29..8.32 rows=1 width=14)
Index Cond: ((object_id = r_1.id) AND (term_id = 20))
Filter: ((object_type = 10) AND (taxonomy_id = ANY ('{399,400,401,402,430,431}'::integer[])))