Re: Strange logic for partial index proving
| От | Tom Lane |
|---|---|
| Тема | Re: Strange logic for partial index proving |
| Дата | |
| Msg-id | 16775.1119385765@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Strange logic for partial index proving (Simon Riggs <simon@2ndquadrant.com>) |
| Ответы |
Re: Strange logic for partial index proving
|
| Список | pgsql-hackers |
Simon Riggs <simon@2ndquadrant.com> writes:
> Sweating over the logic of the theorem prover, I notice it doesn't
> actually bother to complete an accurate test.
Sure it does.
> create index idx1 on tenk (col1) where col1 > 1 and col1 < 10;
> explain select * from tenk where col1 > 5 and col1 < -5;
> [ uses that index ]
This is a perfectly legitimate situation. "col1 > 5" implies "col1 > 1"
and "col1 < -5" implies "col1 < 10", therefore the query WHERE condition
implies the index predicate, therefore the index contains all tuples
that could pass the WHERE condition, therefore the index is usable.
Kindly do not break this.
regards, tom lane
В списке pgsql-hackers по дате отправления: