Re: [PERFORM] psql -A (unaligned format) eats too much

From: Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PERFORM] psql -A (unaligned format) eats too much
Date: 2006-06-05 16:45:13
Message-ID: 44845F99.7050306@dunaweb.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Hi!

Tom Lane írta:
> "Jim C. Nasby" <jnasby(at)pervasive(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Woodward 2006-06-05 16:48:12 Re: [PERFORM] psql -A (unaligned format) eats too much
Previous Message Andrew Dunstan 2006-06-05 16:40:38 Re: [PERFORM] psql -A (unaligned format) eats too much

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Woodward 2006-06-05 16:48:12 Re: [PERFORM] psql -A (unaligned format) eats too much
Previous Message Andrew Dunstan 2006-06-05 16:40:38 Re: [PERFORM] psql -A (unaligned format) eats too much