Re: MAX/MIN optimization via rewrite (plus query rewrites

Поиск
Список
Период
Сортировка
От Mark Kirkwood
Тема Re: MAX/MIN optimization via rewrite (plus query rewrites
Дата
Msg-id 41931AEB.8010807@coretech.co.nz
обсуждение исходный текст
Ответ на Re: MAX/MIN optimization via rewrite (plus query rewrites  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-hackers
There seems to be (as Tom indicated) a choice of approaches:

i) rewrite max/min querys and then plan 'em
ii) provide alternate plans based on presence of certain aggregate types 
in the query

when I first examined this TODO item, I was really thinking about i), 
but I suspect that ii) is probably the best approach.

regards

Mark



Bruno Wolff III wrote:

>On Thu, Nov 11, 2004 at 17:57:42 +1300,
>  Mark Kirkwood <markir@coretech.co.nz> wrote:
>  
>
>>Your example and ones like :
>>
>>SELECT max(foo), count(foo) FROM bar
>>SELECT max(a.foo1), max(b.foo2) FROM bar1 AS a NATURAL JOIN bar2 AS b
>>
>>have made me realize that the scope of "what should be optimized" is 
>>somewhat subtle.
>>
>>I am inclined to keep it simple (i.e rather limited) for a first cut, 
>>and if that works well, then look at extending to more complex rewrites.
>>
>>What do you think?
>>    
>>
>
>I don't think you should be rewriting queries as much as providing
>alternate plans and letting the rest of the optimizer decided which
>plan to use. If you just rewrite a query you might lock yourself into
>using a poor plan.
>  
>


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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: MAX/MIN optimization via rewrite (plus query rewrites
Следующее
От: Mark Kirkwood
Дата:
Сообщение: Re: MAX/MIN optimization via rewrite (plus query rewrites