Re: function calls optimization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: function calls optimization
Дата
Msg-id 19586.1572534410@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: function calls optimization  (Andres Freund <andres@anarazel.de>)
Ответы Re: function calls optimization  (Andres Freund <andres@anarazel.de>)
Re: function calls optimization  (Andy Fan <zhihui.fan1213@gmail.com>)
Список pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On October 31, 2019 7:45:26 AM PDT, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> We've typically supposed that the cost of searching for duplicate
>> subexpressions would outweigh the benefits of sometimes finding them.

> Based on profiles I've seen I'm not sure that's the right choice. Both for when the calls are expensive (say postgis
stuff),and for when a lot of rows are processed. 

Yeah, if your mental model of a function call is some remarkably expensive
PostGIS geometry manipulation, it's easy to justify doing a lot of work
to try to detect duplicates.  But most functions in most queries are
more like int4pl or btint8cmp, and it's going to be extremely remarkable
if you can make back the planner costs of checking for duplicate usages
of those.

Possibly this could be finessed by only trying to find duplicates of
functions that have high cost estimates.  Not sure how high is high
enough.

> I think one part of doing this in a realistic manner is an efficient
> search for redundant expressions. The other, also non trivial, is how to
> even represent re eferences to the results of expressions in other parts of the expression tree / other expressions.

Yup, both of those would be critical to do right.

            regards, tom lane



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

Предыдущее
От: Andreas Karlsson
Дата:
Сообщение: Re: function calls optimization
Следующее
От: Andres Freund
Дата:
Сообщение: Re: function calls optimization