Re: Index not being used in MAX function (7.2.3)

Поиск
Список
Период
Сортировка
От Dann Corbit
Тема Re: Index not being used in MAX function (7.2.3)
Дата
Msg-id D90A5A6C612A39408103E6ECDD77B829408B16@voyager.corporate.connx.com
обсуждение исходный текст
Ответ на Index not being used in MAX function (7.2.3)  (Paulo Jan <admin@digital.ddnet.es>)
Ответы Re: Index not being used in MAX function (7.2.3)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Wednesday, June 11, 2003 10:03 AM
> To: jim@nasby.net
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Index not being used in MAX function (7.2.3)
>
>
> "Jim C. Nasby" <jim@nasby.net> writes:
> > Not to drag this out further, but you might want to hold
> off on that
> > patch. 7.4 is supposed to use indexes for max/min.
>
> Where did you get that idea?
>
> There's been no change in the basic problem, which is that no
> one has proposed a reasonably general method of translating
> aggregates into index manipulations.  Postgres has an
> extremely general, extensible concept of aggregates, and
> we're not going to mess it up with some poorly-designed hack.
>  But show me a clean design and implementation, and it'll go in.

Is this a poorly designed hack:

    Select max(expression) from <join> where <filter>

Becomes:

    If (non_hashed_index_exists_on_expression) then
         /* Transform expression to: */
         select (expression) from <join> where <filter> order by
<expression> limit to 1 rows
      else
         do_what_you_are_doing_right_now
      endif
?

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Index not being used in MAX function (7.2.3)
Следующее
От: Dmitry Tkach
Дата:
Сообщение: Re: Performance of query (fwd)