Re: Aggregate Supporting Functions
От | Tom Lane |
---|---|
Тема | Re: Aggregate Supporting Functions |
Дата | |
Msg-id | 30851.1433860000@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Aggregate Supporting Functions (Kevin Grittner <kgrittn@ymail.com>) |
Ответы |
Re: Aggregate Supporting Functions
Re: Aggregate Supporting Functions |
Список | pgsql-hackers |
Kevin Grittner <kgrittn@ymail.com> writes: > David Rowley <david.rowley@2ndquadrant.com> wrote: >> [ avoid duplicate calculations for related aggregates ] > From the information you have proposed storing, with cost factors > associated with the functions, it seems technically possible to > infer that you could run (for example) the avg() aggregate to > accumulate both but only run the final functions of the aggregates > referenced by the query. That seems like an optimization to try > hard to forget about until you have at least one real-world use > case where it would yield a significant benefit. It seems > premature to optimize for that before having the rest working. Actually, I would suggest that you forget about all the other aspects and *just* do that, because it could be made to work today on existing aggregate functions, and it would not require hundreds-to-thousands of lines of boilerplate support code in the grammar, catalog support, pg_dump, yadda yadda. That is, look to see which aggregates use the same transition function and run that just once. We already have the rule that the final function can't destroy the transition output, so running two different final functions on the same transition result should Just Work. The rest of what David is thinking about could be done in a followon version by allowing the same aggregate to be implemented by any of several transition-function/final-function pairs, then teaching the planner to prefer pairs that let the same transition function be used for several aggregates. But I'd see that as a later refinement that might well fail the bang-for-buck test, and hence shouldn't be the first step. regards, tom lane
В списке pgsql-hackers по дате отправления: