Re: Column reset all values - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: Column reset all values
Date
Msg-id 20200513083549.GA23847@hjp.at
Whole thread Raw
In response to Column reset all values  (otar shavadze <oshavadze@gmail.com>)
List 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@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

pgsql-general by date:

Previous
From: otar shavadze
Date:
Subject: Column reset all values
Next
From: Olivier Gautherot
Date:
Subject: Re: Column reset all values