X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 398669DD5FD for ; Tue, 6 Dec 2005 08:20:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01165-01 for ; Tue, 6 Dec 2005 08:20:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from obelix.askesis.nl (laudanum.demon.nl [82.161.125.16]) by postgresql.org (Postfix) with ESMTP id CFDB79DD5F9 for ; Tue, 6 Dec 2005 08:20:42 -0400 (AST) Received: obelix.askesis.nl 172.31.0.1 from 172.31.1.8 172.31.1.8 via HTTP with MS-WebStorage 6.0.6249 Received: from Panoramix by obelix.askesis.nl; 06 Dec 2005 13:20:45 +0100 Subject: Re: Can this query go faster??? From: Joost Kraaijeveld To: Tino Wildenhain Cc: Csaba Nagy , Pgsql-Performance In-Reply-To: <439577D2.9090208@wildenhain.de> References: <1133862229.8837.61.camel@Panoramix> <1133862777.4779.185.camel@coppola.muc.ecircle.de> <1133864460.8837.69.camel@Panoramix> <439568C4.8050601@wildenhain.de> <1133868084.8837.73.camel@Panoramix> <439577D2.9090208@wildenhain.de> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 06 Dec 2005 13:20:45 +0100 Message-Id: <1133871645.8837.78.camel@Panoramix> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200512/161 X-Sequence-Number: 15982 On Tue, 2005-12-06 at 12:36 +0100, Tino Wildenhain wrote: > > > > I just tried it: a cursor is not faster (what does not surprise me at > > all, as the amount of work looks the same to me) > > Actually no, if you scroll forward, you just ask the database for the > next rows to materialize. So if you are ahead in your database and > ask for next rows, it should be faster then working w/ an offset > from start each time. Ah, a misunderstanding: I only need to calculate an index if the user wants a record that is not in or adjacent to the cache (in which case I can do a "select values > last value in the cache". So I must always materialize all rows below the wanted index. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl