| From: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
|---|---|
| To: | Marcelo Fernandes <marcefern7(at)gmail(dot)com> |
| Cc: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Dominique Devienne <ddevienne(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Best Approach for Swapping a Table with its Copy |
| Date: | 2025-02-16 23:48:43 |
| Message-ID: | CAKAnmm+aGX9_HMbJQrGR8nwFbd60x4NqfexnYi22-wtrCT-cXw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Sun, Feb 16, 2025 at 5:58 PM Marcelo Fernandes <marcefern7(at)gmail(dot)com>
wrote:
> - The foreign keys are not being updated to point to the new table.
>
You started out okay with your test script, but the pg_depend bit needs
work. I would recommend examining that table closely until you have a
really good understanding of how it works - both on the objid and refobjid
side. Create and modify tables and see how the pg_depend entries change.
Hint: Try it with and without foreign keys.
https://www.postgresql.org/docs/current/catalog-pg-depend.html
> - pg_repack seems to update relcache entries. I am not sure how to do that
> with SQL.
Yes, as I mentioned upthread, the safest thing will probably be a restart.
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
| From | Date | Subject | |
|---|---|---|---|
| Next Message | WU Yan | 2025-02-17 06:38:49 | Wasteful nested loop join when there is `limit` in the query |
| Previous Message | Marcelo Fernandes | 2025-02-16 22:58:31 | Re: Best Approach for Swapping a Table with its Copy |