Re: CHECK constraints and optimizations

Поиск
Список
Период
Сортировка
От Troels Arvin
Тема Re: CHECK constraints and optimizations
Дата
Msg-id pan.2004.05.06.19.37.49.49407@arvin.dk
обсуждение исходный текст
Ответ на CHECK constraints and optimizations  (Edmund Dengler <edmundd@eSentire.com>)
Ответы Re: CHECK constraints and optimizations  ("scott.marlowe" <scott.marlowe@ihs.com>)
Список pgsql-general
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?

In particular, I'm interested in the case of join eliminations, based on
foreign key constraints. E.g. having a SUPPLIER(s_id,...) and a
SUPPLIER_PART(s_id,p_id) table where SUPPLIER_PART.s_id references
SUPPLIER.s_id. Then, a "SELECT p_id FROM SUPPLIER_PART NATURAL JOIN
SUPPLIER" could skip the join and just look in SUPPLIER_PART.

Another thing:

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.


By the way, in "An Introduction to Database Systems", Date writes about
semantic optimizations:

  "... such optimization could provide significant
  performance improvements - much greater improvements, very likely,
  than are obtained by any of today's more traditional optimization
  techniques".

--
Greetings from Troels Arvin, Copenhagen, Denmark


В списке pgsql-general по дате отправления:

Предыдущее
От: Jerry LeVan
Дата:
Сообщение: Announce: PgBrowse-0.9
Следующее
От: Chris Browne
Дата:
Сообщение: Re: 7.2 or 7.4 for critical data?