X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 10F4B53821 for ; Mon, 2 May 2005 12:04:18 -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 11612-09 for ; Mon, 2 May 2005 15:04:13 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 922EE54335 for ; Mon, 2 May 2005 12:04:12 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j42F49YK018484; Mon, 2 May 2005 11:04:10 -0400 (EDT) To: Christoph Haller Cc: Andreas Kretschmer , pgsql-sql@postgresql.org Subject: Re: how many tuples on a cursor? In-reply-to: <42760C37.BD6531A8@rodos.fzk.de> References: <20050502071358.GB5962@webserv.wug-glas.de> <42760C37.BD6531A8@rodos.fzk.de> Comments: In-reply-to Christoph Haller message dated "Mon, 02 May 2005 13:17:11 +0200" Date: Mon, 02 May 2005 11:04:09 -0400 Message-ID: <18483.1115046249@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/13 X-Sequence-Number: 21326 Christoph Haller writes: > What else seems to work is MOVE 2147483647 > (INT_MAX) and then get the max number of rows > by PQcmdTuples(). I'd suggest "MOVE FORWARD ALL" rather than hard-wiring assumptions about the maximum possible value of infinity ;-) > But I have no idea how expensive this MOVE is. The rows are all calculated internally --- about all you save compared to a FETCH is data formatting and transmission. If you really have to know this number in advance of fetching the data, that's pretty much what you have to do, but it will cost you ... regards, tom lane