From: Sergei Kornilov <sk@zsrv.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephen Frost <sfrost@snowman.net>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: using index or check in ALTER TABLE SET NOT NULL
Date: Wed, 29 Nov 2017 18:52:36 +0300
Message-ID: <370481511970756@web3j.yandex.ru> (raw)
In-Reply-To: <9878.1511970441@sss.pgh.pa.us>
References: <81911511895540@web58j.yandex.ru>
<CA+TgmoZKR4dTR7KyoM4jfJN2J-eNoBRG2_XHdZa1f0VUbK1xXQ@mail.gmail.com>
<20171129152135.GN4628@tamriel.snowman.net>
<9878.1511970441@sss.pgh.pa.us>
Thanks all for reply!
Robert,
> Doing it based on an index scan doesn't necessarily seem like a good idea. We have
> no guarantee at all that the index scan will be faster than scanning
> the table would have been
I agree this. Thinking a little about idea of index scan i can not give reasonable usecase which required index. My target problem of adding NOT NULL to big relation without long downtime can be done with ADD CONSTRAINT NOT VALID, VALIDATE it in second transaction, then SET NOT NULL by my patch and drop unneeded constraint.
Stephen,
> Just, generally speaking, this is definitely something that I think we
> want and neither of the above concerns seem like they're technical
> reasons why we can't use something like this approach, just needs to
> perhaps be reworked to handle multiple columns in a single query.
I understood the idea, thank you.
Tom,
> I did not look at the patch yet, but TBH if it uses SPI for sub-operations
> of ALTER TABLE I think that is sufficient reason to reject it out of hand.
I understood, thank you.
So, i will soon delete SPI usage and index scan and post new simplified patch with verify data only by constraints.
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: sk@zsrv.org, tgl@sss.pgh.pa.us, sfrost@snowman.net, robertmhaas@gmail.com
Subject: Re: using index or check in ALTER TABLE SET NOT NULL
In-Reply-To: <370481511970756@web3j.yandex.ru>
* 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