Re: Column type modification in big tables - Mailing list pgsql-general

From Lok P
Subject Re: Column type modification in big tables
Date
Msg-id CAKna9Vahx4ow0mtTEbVSeAU+f6U9v6G+Dkr-ymoyNhUZF_GRWw@mail.gmail.com
Whole thread Raw
In response to Re: Column type modification in big tables  (Greg Sabino Mullane <htamfids@gmail.com>)
Responses Re: Column type modification in big tables
List pgsql-general

On Tue, Aug 13, 2024 at 7:39 PM Greg Sabino Mullane <htamfids@gmail.com> wrote:
On Sat, Aug 10, 2024 at 5:06 PM Lok P <loknath.73@gmail.com> wrote:
 
Can someone through some light , in case we get 5-6hrs downtime for this change , then what method should we choose for this Alter operation?

We can't really answer that. Only you know what resources you have, what risk/reward you are willing to handle, and how long things may take. For that latter item, your best bet is to try this out on the same/similar hardware and see how long it takes. Do a smaller table and extrapolate if you need to. 

Hello Greg, 

In terms of testing on sample data and extrapolating, as i picked the avg partition sizeof the table (which is ~20GB) and i created a non partitioned table with exactly same columns and populated with similar data and also created same set of indexes on it and the underlying hardware is exactly same as its on production. I am seeing it's taking ~5minutes to alter all the four columns on this table. So we have ~90 partitions in production with data in them and the other few are future partitions and are blank. (Note- I executed the alter with "work_mem=4GB, maintenance_work_mem=30gb, max_parallel_worker_per_gather=8, max_parallel_maintenance_worker =16" )

So considering the above figures , can i safely assume it will take ~90*5minutes= ~7.5hours in production and thus that many hours of downtime needed for this alter OR do we need to consider any other factors or activity here? 
 

pgsql-general by date:

Previous
From: Vivek Gadge
Date:
Subject: PostgreSQL Upgrade Issue - Undefined Symbol Error
Next
From: Ron Johnson
Date:
Subject: Re: What is the best way to upgrade pgAdmin on Windows?