Re: optimizer question
| От | mlw |
|---|---|
| Тема | Re: optimizer question |
| Дата | |
| Msg-id | 3BC6C4ED.8F9685CD@mohawksoft.com обсуждение исходный текст |
| Ответ на | Re: optimizer question (Bruce Momjian <pgman@candle.pha.pa.us>) |
| Список | pgsql-hackers |
Bruce Momjian wrote: > > > "Reinoud van Leeuwen" <reinoud@xs4all.nl> writes: > > > I have a table that contains almost 8 milion rows. The primary key is a > > > sequence, so the index should have a good distribution. Why does the > > > optimizer refuse to use the index for getting the maximum value? > > > > The optimizer has no idea that max() has anything to do with indexes. > > You could try something like > > > > select * from tab order by foo desc limit 1; > > Can we consider doing this optimization automatically? That would be real cool. I don't know of any database that does that. (I do know that our Oracle 8i does not) On a side note (can of worms?) is there the notion of a "rule based optimizer" vs the cost based optimizer in Postgres?
В списке pgsql-hackers по дате отправления: