Bruno Wolff III <[EMAIL PROTECTED]> writes: > 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.
Moreover, none of these rewritten queries would work properly for select min(foo) from tab group by bar This should still be aware it can use an index on <bar,foo> and get much better performance. Well it can't know, but it should be able to. All it should really need to know is that min() only needs a particular subset of the dataset -- namely the first record, as long as the records are provided in a particular order. Also, the same code ought to be able to handle select first(foo) from tab group by bar Which is exactly equivalent to the min() case except that no particular ordering is required. -- greg ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings