QUERY PLAN
Seq Scan on tbl_calendars c (cost=0.00..1435.59 rows=4 width=20)
Filter: (((start_at IS NOT NULL) OR (end_at IS NOT NULL)) AND (created_by = 1004) AND (((is_public = 1) AND (created_by <> 1004)) OR (created_by = 1004)) AND (((start_at >= '2025-07-01 00:00:00+08'::timestamp with time zone) AND (end_at < '2025-07-31 00:00:00+08'::timestamp with time zone)) OR ((start_at <= '2025-07-01 00:00:00+08'::timestamp with time zone) AND (end_at > '2025-07-01 00:00:00+08'::timestamp with time zone)) OR ((start_at <= '2025-07-31 00:00:00+08'::timestamp with time zone) AND (end_at > '2025-07-31 00:00:00+08'::timestamp with time zone))) AND (created_by = ANY ('{1004,1004,1001,5446,5087,1015,1023,5064,5440,5360,1022,5311,5248,1000,5420,5445,5388,5404,5252,1013,5300,5250,5296,1005,1017,5085,5332,1011,5329,5016,5295}'::integer[])))