Limit (cost=612.03..612.03 rows=2 width=523) |
-> Sort (cost=612.03..612.03 rows=2 width=523) |
Sort Key: s.is_complete, s.end_at DESC, s.created_at DESC |
-> Group (cost=612.00..612.02 rows=2 width=523) |
Group Key: s.id |
-> Sort (cost=612.00..612.00 rows=2 width=519) |
Sort Key: s.id |
-> Nested Loop (cost=588.32..611.99 rows=2 width=519) |
Join Filter: (s.created_by = u.id) |
-> Seq Scan on tbl_users u (cost=0.00..7.76 rows=21 width=4) |
Filter: (department_id = 2) |
-> Materialize (cost=588.32..601.10 rows=10 width=519) |
-> Hash Right Join (cost=588.32..601.05 rows=10 width=519) |
Hash Cond: (ccr.schedule_id = s.id) |
Filter: ((((s.is_public = 1) AND (s.created_by <> 1000)) OR (s.created_by = 1000) OR (ccr.user_id = 1000)) AND ((s.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5300,5311,5332,5360,5388,5446,5449}'::integer[])) OR (ccr.user_id = 1000))) |
-> Seq Scan on tbl_schedule_carbon_copy_rels ccr (cost=0.00..10.91 rows=691 width=8) |
-> Hash (cost=588.11..588.11 rows=17 width=519) |
-> Seq Scan on tbl_schedules s (cost=0.00..588.11 rows=17 width=519) |
Filter: ((NOT is_complete) AND ((end_at >= '2025-09-12 17:11:40+08'::timestamp with time zone) OR (end_at IS NULL))) |