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... ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html