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 CFC0011F6ACB for ; Thu, 6 Apr 2006 14:11:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18704-02 for ; Thu, 6 Apr 2006 14:11:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from a2s5.a2hosting.com (host-209-124-50-10.a2webhosting.com [209.124.50.10]) by postgresql.org (Postfix) with ESMTP id 682FA11F6ABE for ; Thu, 6 Apr 2006 14:11:46 -0300 (ADT) Received: from adsl-6-40-137.tys.bellsouth.net ([65.6.40.137] helo=[192.168.1.10]) by a2s5.a2hosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.52) id 1FRY1I-0007Lt-Sl; Thu, 06 Apr 2006 13:11:45 -0400 In-Reply-To: <44352A25.7010107@faith.digsys.bg> References: <44352A25.7010107@faith.digsys.bg> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: John DeSoi Subject: Re: CURSOR OR OFFSET/LIMIT Date: Thu, 6 Apr 2006 13:11:33 -0400 To: Kaloyan Iliev X-Mailer: Apple Mail (2.746.2) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s5.a2hosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200604/118 X-Sequence-Number: 18202 On Apr 6, 2006, at 10:48 AM, Kaloyan Iliev wrote: > If I use cursors it's better but my problem is that cursors live > only in the current transaction. > So when the Web Server finish I've lost the transaction and the > cursor. Cursors can live outside the transaction if you declare them WITH HOLD specified. But that still may not help you in a web environment if you want to break the results into pages served on separate requests (and possibly different connections). http://www.postgresql.org/docs/8.1/interactive/sql-declare.html > Is there a way to save the cursor between separe Browser request > (and to give it time to live)? Sure, but you need to add a lot of connection management to do this. You would need to keep track of the cursors and make sure a subsequent request uses the right connection. John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL