QUERY PLAN
GroupAggregate (cost=20.57..20.61 rows=2 width=36)
Group Key: "*SELECT* 1".id
-> Sort (cost=20.57..20.57 rows=2 width=10)
Sort Key: "*SELECT* 1".id
-> Append (cost=0.29..20.56 rows=2 width=10)
-> Subquery Scan on "*SELECT* 1" (cost=0.29..11.04 rows=1 width=10)
-> Nested Loop (cost=0.29..11.03 rows=1 width=18)
-> Seq Scan on tbl_erp_other_income_tickets r (cost=0.00..2.70 rows=1 width=4)
Filter: ((verify_at >= '2026-06-01 00:00:00+08'::timestamp with time zone) AND (verify_at <= '2026-06-30 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,439}'::integer[])))
-> Subquery Scan on "*SELECT* 2" (cost=0.29..9.52 rows=1 width=10)
-> Nested Loop (cost=0.29..9.51 rows=1 width=18)
-> Seq Scan on tbl_erp_cost_convert_tickets r_1 (cost=0.00..1.18 rows=1 width=4)
Filter: ((verify_at >= '2026-06-01 00:00:00+08'::timestamp with time zone) AND (verify_at <= '2026-06-30 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,439}'::integer[])))