X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 184099FA5B5 for ; Mon, 5 Jun 2006 14:17:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 48446-10 for ; Mon, 5 Jun 2006 14:17:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from linux.dunaweb.hu (linux.dunaweb.hu [62.77.196.1]) by postgresql.org (Postfix) with ESMTP id 248889FA30C for ; Mon, 5 Jun 2006 14:17:35 -0300 (ADT) Received: from localhost (linux.dunaweb.hu [127.0.0.1]) by linux.dunaweb.hu (Postfix) with ESMTP id E4DE88E056A; Mon, 5 Jun 2006 19:17:32 +0200 (CEST) Received: from linux.dunaweb.hu ([127.0.0.1]) by localhost (linux.dunaweb.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30692-06; Mon, 5 Jun 2006 19:17:31 +0200 (CEST) Received: from [81.17.177.202] (host-81-17-177-202.dunaweb.hu [81.17.177.202]) by linux.dunaweb.hu (Postfix) with ESMTP id 4D5788E0581; Mon, 5 Jun 2006 19:17:31 +0200 (CEST) Message-ID: <4484672B.8080606@dunaweb.hu> Date: Mon, 05 Jun 2006 19:17:31 +0200 From: Zoltan Boszormenyi User-Agent: Thunderbird 1.5.0.2 (X11/20060501) MIME-Version: 1.0 To: Andrew Dunstan Cc: Mark Woodward , Tom Lane , "Jim C. Nasby" , pgsql-hackers@postgresql.org Subject: Re: [PERFORM] psql -A (unaligned format) eats too much References: <44835834.2020309@dunaweb.hu> <44835F86.5040008@dunaweb.hu> <20060605152258.GT53487@pervasive.com> <20512.1149521250@sss.pgh.pa.us> <20060605155349.GU53487@pervasive.com> <20813.1149523235@sss.pgh.pa.us> <18006.24.91.171.78.1149526092.squirrel@mail.mohawksoft.com> <44845E86.3080001@dunslane.net> In-Reply-To: <44845E86.3080001@dunslane.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: amavisd-new at dunaweb.hu X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/166 X-Sequence-Number: 84399 Andrew Dunstan írta: > Mark Woodward wrote: >>> "Jim C. Nasby" writes: >>> >>>> On Mon, Jun 05, 2006 at 11:27:30AM -0400, Tom Lane wrote: >>>> >>>>> I'm reading this as just another uninformed complaint about libpq's >>>>> habit of buffering the whole query result. It's possible that >>>>> there's >>>>> a memory leak in the -A path specifically, but nothing said so far >>>>> provided any evidence for that. >>>>> >>>> Certainly seems like it. It seems like it would be good to allow for >>>> libpq not to buffer, since there's cases where it's not needed... >>>> >>> See past discussions. The problem is that libpq's API says that >>> when it >>> hands you back the completed query result, the command is complete and >>> guaranteed not to fail later. A streaming interface could not make >>> that >>> guarantee, so it's not a transparent substitution. >>> >>> I wouldn't have any strong objection to providing a separate API that >>> operates in a streaming fashion, but defining it is something no one's >>> bothered to do yet. In practice, if you have to code to a variant API, >>> it's not that much more trouble to use a cursor... >>> >>> >> >> Wouldn't the "COPY (select ...) TO STDOUT" format being discussed solve >> this for free? Yes, it would for me. > It won't solve it in the general case for clients that expect a result > set. ISTM that "use a cursor" is a perfectly reasonable answer, though. The general case cannot be applied for all particular cases. E.g. you cannot use cursors from shell scripts and just for producing an "export file" it's not too reasonable either. Redirecting psql's output or COPY is enough. Best regards, Zoltán Böszörényi