Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3ADBE9FBB41 for ; Thu, 22 Mar 2007 15:21:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 30623-07 for ; Thu, 22 Mar 2007 15:21:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from 66-226-76-106.dedicated.abac.net (66-226-76-106.dedicated.abac.net [66.226.76.106]) by postgresql.org (Postfix) with ESMTP id 143129FBB16 for ; Thu, 22 Mar 2007 15:21:36 -0300 (ADT) Received: (qmail 3864 invoked by uid 2020); 22 Mar 2007 10:21:35 -0800 Received: from wsip-70-167-125-69.sd.sd.cox.net (HELO ?192.168.0.51?) (70.167.125.69) by 192.168.0.4 with (DHE-RSA-AES256-SHA encrypted) SMTP; 22 Mar 2007 10:21:35 -0800 Message-ID: <4602C921.3070303@modgraph-usa.com> Date: Thu, 22 Mar 2007 10:21:21 -0800 From: "Craig A. James" User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Steve Atkins , pgsql-performance@postgresql.org Subject: Re: Performance of count(*) 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> In-Reply-To: <228F06CD-3642-4A42-813A-648285A3BDBC@blighty.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.595 tagged_above=0 required=5 tests=AWL, BAYES_40, HELO_DYNAMIC_IPADDR2 X-Spam-Level: ** X-Archive-Number: 200703/347 X-Sequence-Number: 23752 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. > I think the problem is more that most web developers aren't very good > at using the database, and tend to fall back on simplistic, wrong, > approaches > to displaying the data. There's a lot of monkey-see, monkey-do in web > UI design too, which doesn't help. Thanks, I'm sure your thoughtful comments will help me solve my problem. Somehow. ;-) Craig