Adding a nullable DOMAIN column w/ CHECK - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Adding a nullable DOMAIN column w/ CHECK
Date
Msg-id 540A4EDC.1060008@joh.to
Whole thread Raw
Responses Re: Adding a nullable DOMAIN column w/ CHECK
List pgsql-hackers
Hi,

First of all, sorry about breaking the thread; I don't subscribe to
-general so I can't copy the original email.  This is in response to the
problem here:
http://www.postgresql.org/message-id/CACfv+p+8dToaR7h06_M_YMjpV5Na-CQq7kN=KgJq_k84H7UHWA@mail.gmail.com

Attached is a very ugly proof-of-concept patch of how this could work.
With this applied, the ALTER TABLE becomes fast:

=# create domain test_domain numeric check (value > 0);
CREATE DOMAIN
Time: 2,443 ms
=# create table test_domain_table as select generate_series(1, 2000000);
SELECT 2000000
Time: 1802,681 ms
=# alter table test_domain_table add column t test_domain;
ALTER TABLE
Time: 4,991 ms

The patch is obviously a load of horse crap, but does anyone have any
objections to the general approach of making this pattern faster?  To do
this optimization we do have to assume that CHECKs in DOMAINs are at
least STABLE, but I don't see that as a problem; those should be
IMMUTABLE anyway, I think.


.marko

Attachment

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Need Multixact Freezing Docs
Next
From: Stephen Frost
Date:
Subject: Re: A mechanism securing web applications in DBMS