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 3DACA3A48CD for ; Thu, 20 Jan 2005 16:39:25 +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 39261-06 for ; Thu, 20 Jan 2005 16:39:20 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by svr1.postgresql.org (Postfix) with ESMTP id 7956D3A48A5 for ; Thu, 20 Jan 2005 16:39:19 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 50so155365wri for ; Thu, 20 Jan 2005 08:39:17 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=Xi9uejKz0sNZ9WjTSq6LXPzIXl/KG+YIKJZZ2w9yUWESQasmSZJhnTh+kgu2FgymAnrVBxoqoYeQVEQd4viPW5vjKh5KBzayfqTIS5/Mhv0q7noqoNu2bErV0KnKhdZ+KNs/W82qq2A7k+Viw3Io+9/Qn+7nBQHr3lM8+33BHDc= Received: by 10.54.31.62 with SMTP id e62mr131667wre; Thu, 20 Jan 2005 08:39:16 -0800 (PST) Received: by 10.54.18.72 with HTTP; Thu, 20 Jan 2005 08:39:16 -0800 (PST) Message-ID: <33c6269f05012008391490448b@mail.gmail.com> Date: Thu, 20 Jan 2005 11:39:16 -0500 From: Alex Turner Reply-To: alex@neteconomist.com To: Richard Huxton Subject: Re: [SQL] OFFSET impact on Performance??? Cc: Andrei Bintintan , pgsql-sql@postgresql.org, pgsql-performance@postgresql.org In-Reply-To: <41EFCC5B.5010302@archonet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <019f01c4fee1$1b58d600$0b00a8c0@forge> <41EF9FD3.5020400@archonet.com> <020d01c4fef6$595bb9d0$0b00a8c0@forge> <41EFCC5B.5010302@archonet.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/315 X-Sequence-Number: 10005 I am also very interesting in this very question.. Is there any way to declare a persistant cursor that remains open between pg sessions? This would be better than a temp table because you would not have to do the initial select and insert into a fresh table and incur those IO costs, which are often very heavy, and the reason why one would want to use a cursor. Alex Turner NetEconomist On Thu, 20 Jan 2005 15:20:59 +0000, Richard Huxton wrote: > 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 >