I'm using 8.2 and using order by & limit is still faster than MAX()
even though MAX() now seems to rewrite to an almost identical plan
internally.
Count(*) still seems to use a full table scan rather than an index scan.
Using one of our tables, MySQL/Oracle/MS-SQL all return instantly while
PG takes longer ther 700ms. Luckily we can design around this issue.
-----Original Message-----
From: pgsql-performance-owner@postgresql.org
[mailto:pgsql-performance-owner@postgresql.org] On Behalf Of Craig A.
James
Sent: Sunday, January 07, 2007 5:57 PM
To: Guy Rouillier; PostgreSQL Performance
Subject: Re: [PERFORM] High update activity, PostgreSQL vs BigDBMS
Craig A. James wrote:
> The "idiom" to replace count() was
> "select col from tbl order by col desc limit 1". It worked miracles
for
> my app.
Sorry, I meant to write, "the idiom to replace MAX()", not count()...
MAX() was the function that was killing me, 'tho count() also gave me
problems.
Craig
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend