Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AB1289FA3DA for ; Sun, 7 Jan 2007 22:25:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 93064-05 for ; Sun, 7 Jan 2007 22:25:40 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from smtp108.sbc.mail.re2.yahoo.com (smtp108.sbc.mail.re2.yahoo.com [68.142.229.97]) by postgresql.org (Postfix) with SMTP id 057D79FB1ED for ; Sun, 7 Jan 2007 22:25:32 -0400 (AST) Received: (qmail 30764 invoked from network); 8 Jan 2007 02:25:31 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=sbcglobal.net; h=Received:X-YMail-OSG:From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:X-Priority:X-MSMail-Priority:X-Mailer:X-MimeOLE:In-Reply-To:Importance; b=v8+XJ0emtTD2oQV1t2/xTeCDbxPiiTiwEIswVkk5MSXpSx1FYGZooQ6hJMNOTd9PwC7HYwpi7qRjc+RV9bRSfUz8i8Ja3RPoH+xQNvQ1yV1BmxNCt/h1L0YWRLbk6cLIEWRgp2Oj663REA6yIMoJEy+YM2pFFfhVyXW+W1Z2t1Y= ; Received: from unknown (HELO dualcore) (adam.r@sbcglobal.net@75.2.73.81 with login) by smtp108.sbc.mail.re2.yahoo.com with SMTP; 8 Jan 2007 02:25:31 -0000 X-YMail-OSG: SR2FyAMVM1nwTUpzyz63rc_lef7jRwvIlVJA5iSSiAeQx01IoTQH7oFJnVqyUS_JSlesp5Dzn5wZZ1zxxN7Mn6F40fz8f15m0_uljxI0f9IYVgjmhgimWuy1E.h9ewBZ_PdVMy62fmby2ZE- From: "Adam Rich" To: "'Craig A. James'" , "'Guy Rouillier'" , "'PostgreSQL Performance'" Subject: Re: High update activity, PostgreSQL vs BigDBMS Date: Sun, 7 Jan 2007 20:26:29 -0600 Message-ID: <022d01c732cc$69f0e2a0$6400a8c0@dualcore> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2826 In-Reply-To: <45A188AF.5070006@modgraph-usa.com> Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.892 tagged_above=0 required=5 tests=AWL, BAYES_05, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: X-Archive-Number: 200701/89 X-Sequence-Number: 22690 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