Re: Column reset all values

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Column reset all values
Date: 2020-05-13 08:35:49
Message-ID: 20200513083549.GA23847@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2020-05-13 12:13:20 +0400, otar shavadze wrote:
> postgres version 12
> I have very simple update query, like this:
>
> update my_table 
> set 
> col = NULL
> where
> col IS NOT NULL;
>
> my_table contains few million rows, col is indexed column

You might want to drop the index before doing this. You obviously won't
need the index afterwards and the database may be able to use HOT
updates if there is no index on the column (but that depends on the
amount of unused space in each block).

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Olivier Gautherot 2020-05-13 09:15:31 Re: Column reset all values
Previous Message otar shavadze 2020-05-13 08:13:20 Column reset all values