Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:
> What about having a new column in pg_aggregate which would point to a
> function that would try to optimize the aggregate's handling?
I can't get very excited about this, because how would you make a
reasonably stable/narrow API for such a thing? The function as you
propose it would have to know everything about not only the planner's
data representations but the N specific places it would be called from.
The existing selectivity functions are bad enough on this score ...
regards, tom lane