pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: Column reset all values
Date: Wed, 13 May 2020 10:35:49 +0200
Message-ID: <20200513083549.GA23847@hjp.at> (raw)
In-Reply-To: <CAG-jOyDg7TZ_x1rsL=URVc51sPxfNvi1YMWsLQmeqT1eCtVsTg@mail.gmail.com>
References: <CAG-jOyDg7TZ_x1rsL=URVc51sPxfNvi1YMWsLQmeqT1eCtVsTg@mail.gmail.com>

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!"

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (5+ messages)  latest in thread

Message-ID: <20200513083549.GA23847@hjp.at>
Permalink:  ../20200513083549.GA23847@hjp.at/
Also on:    postgresql.org/message-id/20200513083549.GA23847@hjp.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: hjp-pgsql@hjp.at
  Subject: Re: Column reset all values
  In-Reply-To: <20200513083549.GA23847@hjp.at>
  References: <CAG-jOyDg7TZ_x1rsL=URVc51sPxfNvi1YMWsLQmeqT1eCtVsTg@mail.gmail.com> <20200513083549.GA23847@hjp.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox