X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D022CDA401 for ; Thu, 6 Oct 2005 17:39:26 -0300 (ADT) 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 80303-10 for ; Thu, 6 Oct 2005 20:39:22 +0000 (GMT) Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by svr1.postgresql.org (Postfix) with ESMTP id E8515DA3C9 for ; Thu, 6 Oct 2005 17:39:23 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1ENcWF-0006G6-00; Thu, 06 Oct 2005 16:39:12 -0400 To: Tom Lane Cc: Richard Huxton , andrew@pillette.com, pgsql-sql@postgresql.org Subject: Re: MOVE in SQL vs PLPGSQL References: <200510051417.j95EH0518161@pillette.com> <4343EABB.6030808@archonet.com> <19176.1128526984@sss.pgh.pa.us> In-Reply-To: <19176.1128526984@sss.pgh.pa.us> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 06 Oct 2005 16:39:11 -0400 Message-ID: <87u0fu5qj4.fsf@stark.xeocode.com> Lines: 25 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.011 required=5 tests=[AWL=0.011] X-Spam-Level: X-Archive-Number: 200510/64 X-Sequence-Number: 22917 Tom Lane writes: > Richard Huxton writes: > > Ah, now I see what you're saying. You're quite right in your suspicions, > > "MOVE..." isn't supported for plpgsql cursors. You could probably do > > something with EXECUTE and returning a refcursor from a previous > > function, but that sounds fiddly. > > > I must admit, on the odd occasion I want to skip a row, I just FETCH it > > and move on. Anyone else? > > There is something on the TODO list about improving plpgsql's cursor > functionality --- there's no reason it shouldn't have MOVE, except that > no one got around to it yet. Though the original poster should realize, a MOVE command would be only marginally more efficient than just fetching those records. It would save the network overhead and context switches involved in communicating those records, but there's no way it would let the server avoid reading all those records from disk. At least as far as I can see. -- greg