X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 833AE3A48A3; Thu, 20 Jan 2005 18:05:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53267-05; Thu, 20 Jan 2005 18:04:51 +0000 (GMT) Received: from COLSWEEPER.cranel.com (newmail.cranel.com [66.192.200.227]) by svr1.postgresql.org (Postfix) with ESMTP id E430E3A4807; Thu, 20 Jan 2005 18:04:51 +0000 (GMT) Received: from colmail01.cranel.local (colmail01.cranel.local) by COLSWEEPER.cranel.com (Content Technologies SMTPRS 4.3.14) with ESMTP id ; Thu, 20 Jan 2005 13:02:44 -0500 Received: by colmail01.cranel.local with Internet Mail Service (5.5.2657.72) id ; Thu, 20 Jan 2005 13:04:03 -0500 Message-ID: <387C22290D3FD71195D300508BF7DB5238B017@colmail01.cranel.local> From: "Spiegelberg, Greg" To: 'Richard Huxton' , Andrei Bintintan Cc: pgsql-sql@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [SQL] OFFSET impact on Performance??? Date: Thu, 20 Jan 2005 13:04:02 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200501/329 X-Sequence-Number: 10019 Isn't this a prime example of when to use a servlet or something similar in function? It will create the cursor, maintain it, and fetch against it for a particular page. Greg -----Original Message----- From: Richard Huxton [mailto:dev@archonet.com] Sent: Thursday, January 20, 2005 10:21 AM To: Andrei Bintintan Cc: pgsql-sql@postgresql.org; pgsql-performance@postgresql.org Subject: Re: [PERFORM] [SQL] OFFSET impact on Performance??? Andrei Bintintan wrote: >> If you're using this to provide "pages" of results, could you use a >> cursor? > > What do you mean by that? Cursor? > > Yes I'm using this to provide "pages", but If I jump to the last pages > it goes very slow. DECLARE mycursor CURSOR FOR SELECT * FROM ... FETCH FORWARD 10 IN mycursor; CLOSE mycursor; Repeated FETCHes would let you step through your results. That won't work if you have a web-app making repeated connections. If you've got a web-application then you'll probably want to insert the results into a cache table for later use. -- Richard Huxton Archonet Ltd ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly