Re: CHECK constraints and optimizations - Mailing list pgsql-general

From scott.marlowe
Subject Re: CHECK constraints and optimizations
Date
Msg-id Pine.LNX.4.33.0405061439500.5780-100000@css120.ihs.com
Whole thread Raw
In response to Re: CHECK constraints and optimizations  (Troels Arvin <troels@arvin.dk>)
List pgsql-general
On Thu, 6 May 2004, Troels Arvin wrote:

> On Wed, 05 May 2004 21:09:25 -0400, Tom Lane wrote:
>
> >> Just trying some tests out, and wanted to know about some optimizations.
> >> If I do a CHECK constraint on a table, is this used to optimize a SELECT
> >
> > It is not.
>
> I one were to try to add some constraint-based optimizations ("semantic
> query optimizations"), what parts of the code would be most relevant to
> study?

I'll leave the answer to such a question to someone who knows the
internals of pgsql a bit better than me.

> Oracle and PostgreSQL uses IOs to respond to
> SELECT * FROM person WHERE age < 30 AND age > 30.
> DB2 and MySQL sees that the result is the empty set, without wasting IOs.
> - So here's another place for potential optimizations, although the area
> is rather hairy, as soon as one moves beyond the most simple cases.

The postgresql team considers the load on their plates to be great enough
without bothering to optimize highly non-optimal, poorly thought out
queries.

I.e. if you're asking for things like in that where clause, no one's gonna
optimize that.  There's already too much to do around here without
focusing on that.  Now, if someone gets an itch and wants to try and code
it in their spare time...


pgsql-general by date:

Previous
From: Rob
Date:
Subject: Re: Announce: PgBrowse-0.9
Next
From: Martijn van Oosterhout
Date:
Subject: Re: CHECK constraints and optimizations