Re: UNIQUE predicate

From: nconway(at)klamath(dot)dyndns(dot)org (Neil Conway)
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: UNIQUE predicate
Date: 2002-07-09 20:16:01
Message-ID: 20020709201600.GA13351@klamath.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Sat, Jul 06, 2002 at 05:32:53PM -0400, Tom Lane wrote:
> nconway(at)klamath(dot)dyndns(dot)org (Neil Conway) writes:
> > The attached patch implements the SQL92 UNIQUE predicate.
>
> The implementation seems to be well short of usefulness in a production
> setting, for two reasons: (1) you're accumulating all the tuples into
> memory --- what if they don't fit? (2) the comparison step is O(N^2),
> which renders the first point rather moot ... a test case large enough
> to risk memory exhaustion will not complete in your lifetime.

That's true -- I probably should have noted in the original email that
my implementation was pretty much "the simplest thing that works".

> I think a useful implementation will require work in the planner to
> convert the UNIQUE predicate into a SORT/UNIQUE plan structure (somewhat
> like the way DISTINCT is implemented, but we just want a boolean
> result).

Hmmm... that's certainly possible, but I'm not sure the feature is
important enough to justify that much effort.

Cheers,

Neil

--
Neil Conway <neilconway(at)rogers(dot)com>
PGP Key ID: DB3C29FC

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2002-07-09 20:17:22 Re: (A) native Windows port
Previous Message Christopher Murtagh 2002-07-09 20:14:36 Re: I am being interviewed by OReilly

Browse pgsql-patches by date

  From Date Subject
Next Message Joe Conway 2002-07-09 20:36:47 Table Function API patch (was Re: another SRF question)
Previous Message J. R. Nield 2002-07-09 19:56:27 First group of logging changes for PITR