Re: [PERFORM] psql -A (unaligned format) eats too much - Mailing list pgsql-hackers

From Zoltan Boszormenyi
Subject Re: [PERFORM] psql -A (unaligned format) eats too much
Date
Msg-id 44845F99.7050306@dunaweb.hu
Whole thread Raw
In response to Re: [PERFORM] psql -A (unaligned format) eats too much memory  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi!

Tom Lane írta:
> "Jim C. Nasby" <jnasby@pervasive.com> writes:
>   
>> I've been able to verify this on 8.1.4; psql -A -t -c 'SELECT * FROM
>> largetable' > /dev/null results in psql consuming vast quantities of
>> memory. Why is this?
>>     
>
> Is it different without the -A?
>
> 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.
>
>             regards, tom lane
>   

So, is libpq always buffering the result? Thanks.
I thought psql buffers only because in its formatted output mode
it has to know the widest value for all the columns.

Then the SELECT INTO TEMP ; COPY TO STDOUT solution
I found is _the_ solution.

I guess then the libpq-based ODBC driver suffers
from the same problem? It certainly explains the
performance problems I observed: the server
finishes the query, the ODBC driver (or libpq underneath)
fetches all the records and the application receives
the first record after all these. Nice.

Best regards,
Zoltán Böszörményi



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: [PERFORM] psql -A (unaligned format) eats too much
Next
From: "Mark Woodward"
Date:
Subject: Re: [PERFORM] psql -A (unaligned format) eats too much