Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id AF64E9FB99C for ; Thu, 22 Mar 2007 14:43:34 -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 57564-01 for ; Thu, 22 Mar 2007 14:43:22 -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 BAAA19FB7AF for ; Thu, 22 Mar 2007 14:43:23 -0300 (ADT) Received: (qmail 2448 invoked by uid 2020); 22 Mar 2007 09:43:22 -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 09:43:22 -0800 Message-ID: <4602C02C.2080703@modgraph-usa.com> Date: Thu, 22 Mar 2007 09:43:08 -0800 From: "Craig A. James" User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Tino Wildenhain CC: 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> <4602BC84.8030101@wildenhain.de> In-Reply-To: <4602BC84.8030101@wildenhain.de> 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.601 tagged_above=0 required=5 tests=AWL, BAYES_40, HELO_DYNAMIC_IPADDR2 X-Spam-Level: ** X-Archive-Number: 200703/345 X-Sequence-Number: 23750 Tino Wildenhain wrote: >> 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) That's my whole point: If relational databases had a simple mechanism for storing their internal state in an external application, the need for cursors, connection pools, and all those other tricks would be eliminated. As I said earlier, relational technology was invented in an earlier era, and hasn't caught up with the reality of modern web apps. > If its a naive web application you just store your session > in tables where you can easily maintain the scroll state > as well. One thing I've learned in 25 years of software development is that people who use my software have problems I never imagined. I've been the one who was naive when I said similar things about my customers, and was later embarrassed to learn that their problems were more complex than I ever imagined. Craig