Re: Request for Insights on ID Column Migration Approach

2024-10-05 Thread Peter J. Holzer
On 2024-09-27 18:37:35 -0400, Tom Lane wrote: > "Peter J. Holzer" writes: > > As you can see, adding the primary key takes just as much time as > > creating the unique index. So it doesn't look like PostgreSQL is able to > > take advantage of the existing index (which makes sense since it still >

Re: Request for Insights on ID Column Migration Approach

2024-09-27 Thread Tom Lane
"Peter J. Holzer" writes: > As you can see, adding the primary key takes just as much time as > creating the unique index. So it doesn't look like PostgreSQL is able to > take advantage of the existing index (which makes sense since it still > has to create a new index). No, but you can attach an

Re: Request for Insights on ID Column Migration Approach

2024-09-27 Thread Peter J. Holzer
On 2024-09-27 07:26:45 +0530, Aditya Singh wrote: > we plan to migrate from the int4 ID column to an int8 ID column. > > The plan involves renaming the int8 column to the id column and setting it as > the primary key. However, this process will require downtime, which may be > substantial in a pro

Re: Request for Insights on ID Column Migration Approach

2024-09-26 Thread Muhammad Usman Khan
Hi, Your approach to migrating the ID column from int4 to int8 with minimal downtime is generally sound but in my option, consider the following also: - Consider using PostgreSQL's CONCURRENTLY option when creating the unique index to avoid locking the entire table - Make sure to first