Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYmru-0003bn-LU for pgsql-general@arkaria.postgresql.org; Wed, 13 May 2020 08:35:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jYmrt-0006RZ-D9 for pgsql-general@arkaria.postgresql.org; Wed, 13 May 2020 08:35:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYmrs-0006RR-If for pgsql-general@lists.postgresql.org; Wed, 13 May 2020 08:35:56 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYmrn-00010U-SZ for pgsql-general@lists.postgresql.org; Wed, 13 May 2020 08:35:55 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id DA90D3049; Wed, 13 May 2020 10:35:49 +0200 (CEST) Date: Wed, 13 May 2020 10:35:49 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Column reset all values Message-ID: <20200513083549.GA23847@hjp.at> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pWyiEgJYm5f9v55/" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --pWyiEgJYm5f9v55/ Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-05-13 12:13:20 +0400, otar shavadze wrote: > postgres version 12 > I have very simple update=A0query, like this: >=20 > update my_table=A0 > set=A0 > col =3D NULL > where > col IS NOT NULL; >=20 > 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 --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --pWyiEgJYm5f9v55/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAl67sWEACgkQ8g5IURL+ KF38SQ/+NQJbNbFXZCgYWdKviI5yAQ9xwsGNvrIsu+FmRjM2aVDtLZ0Q/ht54o7g w+HWTl0NTcg9ruQO1+v1UAL8t/Z1XvBqLp8CHhbW5M+FcEOkhu+D38YMZVW4hO8+ wn0Tq5A2+iYFb8PJRtKdGpz3Dvrj57npDgyszuxUkHW2NqEb6Wo75wUMIm4tq5q5 w9zcV3/CjZl3kkytvBEgvJW+ur9gTwZ8YBnWWziG0tNM8KA0RcRCKFfaF0TZ8a2g fefc5CFdAjiQGXEV0dc1lOqiegT4dHIIoh/54RjO+V/0VGtz/s+3zmLYn7eDssG2 UPDLdbr4QDaX3ne177nz3HhEtsSPXXdm17t1DB0fWrTrdD/SJOXMmdn5zv2p42DZ VNZZYA+az4xxEQ8eoPDbllsJIwf++7tgwPPFhI57nJNduCo2F3DuXSC1MZizLEuf vlaNuHkuqIGAv5g2xdNK3zPCgtfxY1R0bzRFZQisWRDAMDP77a2vimHKrMvqBDt4 X6o/1JjrZBidlJq9i2/zjgdk5jhBpd87QFUF+sA2BEMgqCiJegpxiDRT3MBsa7oi J0j/gQDn/oHX4yTKcJ8liGdGQSTCilru6y8Ck5UHfx8VVeO9ZdqeAXSHMa3GDis0 D6CTWXBMu2BcjSfTH7O6+Ex9/46vvwi4Wrtdu/fzRYt+GC9BdgY= =/Hyj -----END PGP SIGNATURE----- --pWyiEgJYm5f9v55/--