On Tue, Sep 09, 2003 at 12:54:04 -0400, Greg Stark <[EMAIL PROTECTED]> wrote: > > So what would it take to implement this for "all" aggregates? Where I think > "all" really just means min(), max(), first(), last().
There can be other aggregates where indexes are helpful. The case of interest is when functions such that if the new item is contains the current value of the aggregate then the new value of the aggregate with be that of the current item. This allows you to skip looking at all of the other items contained in the current item. Dual problems can also benefit in a similar manner. In a case where the set is totally ordered by the contains index (as is the case or max and min) then the problem is even simpler and you can use the greatest or least element as appropiate. ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match