Re: WIP: generalized index constraints - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: WIP: generalized index constraints
Date
Msg-id 1253004417.24770.47.camel@jdavis
Whole thread Raw
In response to Re: WIP: generalized index constraints  (Brendan Jurd <direvus@gmail.com>)
Responses Re: WIP: generalized index constraints
Re: WIP: generalized index constraints
List pgsql-hackers
On Sun, 2009-09-13 at 19:08 +1000, Brendan Jurd wrote:
> Any update on this patch?

Attached is the latest version.

Changes:

 * Merged with HEAD
 * Changed from storing the information in pg_index to pg_constraint.
   This required rewriting a large portion of the patch, so it's not a
   clean diff from the previous patch.
 * Implemented the language using ALTER TABLE to add the constraint, as
   discussed (with a slight change to avoid the extra "INDEX" keyword).
 * Added docs
 * Added tests
 * All relations with relindconstraints == 0 do not pass through the
   index constraints enforcement code at all. I did this a little
   differently than what I laid out in the design, but the idea is the
   same and it should avoid any problems.

That's the good news. The bad news:

 * No pg_dump support yet (shouldn't be too hard)
 * Creating a new constraint does not check the existing data for
   conflicts.
 * Doesn't work like the new deferrable unique constraints yet (also
   shouldn't be too hard).
 * I didn't make any changes to the behavior of LIKE (also not hard).
 * Can't be specified at CREATE INDEX time. I don't think this is a
   showstopper, and it will take some significant effort. The advantage
   of allowing this is that the constraints can be checked more quickly
   (in theory) while building the index, and it also might be handy
   shorthand. However, it suffers from a number of problems:
     1. Extra syntax that is almost entirely redundant.
     2. More work.
     3. The performance gains will probably be pretty marginal. We have
        to do N index scans anyway; the savings would only be due to
        the better caching impact and the fact that the index in the
        process of being built is smaller than an already-built index.
   So, right now I'm not in a hurry to fix this last point.

I realize that some of the things missing make the patch uncomittable in
its current form. However, I would still appreciate a review of what I
have ready.

Regards,
    Jeff Davis

Attachment

pgsql-hackers by date:

Previous
From: Grzegorz Jaskiewicz
Date:
Subject: Re: clang's static checker report.
Next
From: Heikki Linnakangas
Date:
Subject: Re: Resjunk sort columns, Heikki's index-only quals patch, and bug #5000