Re: optimizer question

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: optimizer question
Дата
Msg-id 3BC66354.D6C0BA95@tm.ee
обсуждение исходный текст
Ответ на Re: optimizer question  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы 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?

Only if we assume that people do not define their own max() that does
something 
that can't be calculated using the above formula like calculating AVG().

---------------
Hannu


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

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Unicode combining characters
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: Deadlock? idle in transaction