Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B92B99FB5BA for ; Thu, 22 Mar 2007 15:37:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 82267-06 for ; Thu, 22 Mar 2007 15:37:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 969639FA3A3 for ; Thu, 22 Mar 2007 15:37:31 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l2MIbQTO020589; Thu, 22 Mar 2007 14:37:26 -0400 (EDT) To: "Craig A. James" cc: Steve Atkins , pgsql-performance@postgresql.org Subject: Re: Performance of count(*) In-reply-to: <4602C921.3070303@modgraph-usa.com> References: <200703221208.19358.albert@sedifa.com> <20070322141807.GE11402@mathom.us> <46029DE3.9030505@modgraph-usa.com> <4602A15B.7000908@wildenhain.de> <4602BB19.9050306@modgraph-usa.com> <228F06CD-3642-4A42-813A-648285A3BDBC@blighty.com> <4602C921.3070303@modgraph-usa.com> Comments: In-reply-to "Craig A. James" message dated "Thu, 22 Mar 2007 10:21:21 -0800" Date: Thu, 22 Mar 2007 14:37:26 -0400 Message-ID: <20588.1174588646@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/353 X-Sequence-Number: 23758 "Craig A. James" writes: > Steve Atkins wrote: >> As long as you're ordering by some row in the table then you can do that in >> straight SQL. >> >> select a, b, ts from foo where (stuff) and foo > X order by foo limit 10 >> >> Then, record the last value of foo you read, and plug it in as X the next >> time around. > We've been over this before in this forum: It doesn't work as advertised. Look for postings by me regarding the fact that there is no way to tell the optimizer the cost of executing a function. There's one, for example, on Oct 18, 2006. You mean http://archives.postgresql.org/pgsql-performance/2006-10/msg00283.php ? I don't see anything there that bears on Steve's suggestion. (The complaint is obsolete as of CVS HEAD anyway.) regards, tom lane