On Thu, May 25, 2006 at 04:07:19PM -0400, Merlin Moncure wrote:
> been doing a lot of pgsql/mysql performance testing lately, and there
> is one query that mysql does much better than pgsql...and I see it a
> lot in normal development:
>
> select a,b,max(c) from t group by a,b;
>
> t has an index on a,b,c.
The planner _should_ TTBOMK be able to do it by itself in 8.1, but have you
tried something along the following lines?
select a,b,(select c from t t2 order by c desc where t1.a=t2.a and t1.b=t2.b)
from t t1 group by a,b;
/* Steinar */
--
Homepage: http://www.sesse.net/