Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 5DCBB9FB922 for ; Thu, 22 Mar 2007 17:35:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 85359-05 for ; Thu, 22 Mar 2007 17:35:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from service-web.de (p15093784.pureserver.info [217.160.106.224]) by postgresql.org (Postfix) with ESMTP id 46A009FBC4F for ; Thu, 22 Mar 2007 17:35:53 -0300 (ADT) Received: from [192.168.178.99] (p548b222e.dip0.t-ipconnect.de [84.139.34.46]) by service-web.de (Postfix) with ESMTP id F03B9200099; Thu, 22 Mar 2007 21:35:52 +0100 (CET) Message-ID: <4602E8A6.9060600@wildenhain.de> Date: Thu, 22 Mar 2007 21:35:50 +0100 From: Tino Wildenhain User-Agent: Thunderbird 1.5.0.5 (X11/20060728) MIME-Version: 1.0 To: "Craig A. James" 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> <4602C02C.2080703@modgraph-usa.com> In-Reply-To: <4602C02C.2080703@modgraph-usa.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/359 X-Sequence-Number: 23764 Craig A. James schrieb: > 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. Well the cursor is exactly the simple handle to the internal state of the relational db you are looking for. Do you really think transferring the whole query-tree, open index and data files to the client over the network would really improve the situation? > As I said earlier, relational technology was invented in an earlier era, > and hasn't caught up with the reality of modern web apps. There is nothing modern with todays 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. Sure it really depends on the application how the best solution would look like but I'm quite certain, counterfaiting internal stuff of the underlying relational database in the application makes more problems then it solves. If you can't handle SQL, dont use SQL, you can build web applications w/o any relational database if you want it. Regards Tino Wildenhain