From: eike@inter.net
To: pgsql-bugs@postgresql.org
Subject: BUG #10591: setting newly added columns to null is slow
Date: Tue, 10 Jun 2014 18:37:19 +0000
Message-ID: <20140610183719.2589.93121@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 10591
Logged by: Eike Dierks
Email address: eike@inter.net
PostgreSQL version: 9.2.1
Operating system: OSX 10.9, centos on virtuozzo linux-2.6.18-028stab
Description:
- given demo_table with some amount of data
- add new_column (works instantely)
- add a unique contraint on new_column
- update demo_table set new_colum=null; (quite slow)
-> takes a long time: seems to rewrite the whole table
I guess that adding a new column does not yet reserve space for that new
column on disk, but that the on-disk layout is only changed as soon as I do
the update (aka making the column physically present on disk)
I fully understand that this is a sensible tradeoff and that this is the
intended behaviour.
However from my uneducated guess (not tested) I believe that a vacuum full
followed by the update would have been much faster.
I somehow believe that my first sequence of commands did make the new_column
virtual first and then physically for every row in turn, thereby taking a
long time to complete.
I'd like to suggest to add to the documentation (if it's not already in
there)
It should be stated that a vacuum full might speed up further access to a
newly introduced column.
But again I did not fully test that scenario, it's just my guess.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: eike@inter.net
Subject: Re: BUG #10591: setting newly added columns to null is slow
In-Reply-To: <20140610183719.2589.93121@wrigleys.postgresql.org>
References: <20140610183719.2589.93121@wrigleys.postgresql.org>
* 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