Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 8726F9FB73E for ; Thu, 22 Mar 2007 14:39:55 -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 56270-01 for ; Thu, 22 Mar 2007 14:39:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by postgresql.org (Postfix) with ESMTP id BDF019FB7AF for ; Thu, 22 Mar 2007 14:39:49 -0300 (ADT) Received: from osgiliath.mathom.us ([72.66.31.15]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JFB00HQZFQ8FU09@vms046.mailsrvcs.net> for pgsql-performance@postgresql.org; Thu, 22 Mar 2007 12:39:45 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id C5447707E0 for ; Thu, 22 Mar 2007 13:39:34 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TsCeCXyAfO1Z for ; Thu, 22 Mar 2007 13:39:33 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 3AD1A712E9; Thu, 22 Mar 2007 13:39:33 -0400 (EDT) Date: Thu, 22 Mar 2007 13:39:32 -0400 From: Michael Stone Subject: Re: Performance of count(*) In-reply-to: <4602BC84.8030101@wildenhain.de> To: pgsql-performance@postgresql.org Mail-followup-to: pgsql-performance@postgresql.org Message-id: <20070322173930.GI11402@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Virus-Scanned: Debian amavisd-new at mathom.us X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 References: <200703221208.19358.albert@sedifa.com> <20070322141807.GE11402@mathom.us> <46029DE3.9030505@modgraph-usa.com> <4602A15B.7000908@wildenhain.de> <4602BB19.9050306@modgraph-usa.com> <4602BC84.8030101@wildenhain.de> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/344 X-Sequence-Number: 23749 On Thu, Mar 22, 2007 at 06:27:32PM +0100, Tino Wildenhain wrote: >Craig A. James schrieb: >>You guys can correct me if I'm wrong, but the key feature that's missing >>from Postgres's flexible indexing is the ability to maintain state >>across queries. Something like this: >> >> select a, b, my_index_state() from foo where ... >> offset 100 limit 10 using my_index(prev_my_index_state); >> > >Yes, you are wrong :-) The technique is called "CURSOR" >if you maintain persistent connection per session >(e.g. stand allone application or clever pooling webapplication) Did you read the email before correcting it? From the part you trimmed out: >The problem is that relational databases were invented before the web >and its stateless applications. In the "good old days", you could >connect to a database and work for hours, and in that environment >cursors and such work well -- the RDBMS maintains the internal state of >the indexing system. But in a web environment, state information is >very difficult to maintain. There are all sorts of systems that try >(Enterprise Java Beans, for example), but they're very complex. It sounds like they wrote their own middleware to handle the problem, which is basically what you suggested (a "clever pooling web application") after saying "wrong". Mike Stone