Re: update faster way - Mailing list pgsql-general

From Igor Korot
Subject Re: update faster way
Date
Msg-id CA+FnnTxqBu+eM1G-8LQhGXEqSdndUYPEk6rc4zSspCivRf9CZQ@mail.gmail.com
Whole thread Raw
In response to update faster way  (yudhi s <learnerdatabase99@gmail.com>)
Responses Re: update faster way
List pgsql-general
Hii,

On Fri, Sep 13, 2024 at 10:22 PM yudhi s <learnerdatabase99@gmail.com> wrote:
>
> Hello,
> We have to update a column value(from numbers like '123' to codes like 'abc' by looking into a reference table data)
ina partitioned table with billions of rows in it, with each partition having 100's millions rows. As we tested for
~30millionrows it's taking ~20minutes to update. So if we go by this calculation, it's going to take days for updating
allthe values. So my question is 
>
> 1) If there is any inbuilt way of running the update query in parallel (e.g. using parallel hints etc) to make it run
faster?
> 2) should we run each individual partition in a separate session (e.g. five partitions will have the updates done at
sametime from 5 different sessions)? And will it have any locking effect or we can just start the sessions and let them
runwithout impacting our live transactions? 

Do you have any indexes?
If not - you should, if yes - what are they?

Thank you.

>
> UPDATE tab_part1
> SET column1 = reftab.code
> FROM reference_tab reftab
> WHERE tab_part1.column1 = subquery.column1;
>
> Regards
> Yudhi



pgsql-general by date:

Previous
From: yudhi s
Date:
Subject: update faster way
Next
From: yudhi s
Date:
Subject: Re: update faster way