Re: Very slow bytea extraction

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "msmbarabino(at)virgilio(dot)it" <msmbarabino(at)virgilio(dot)it>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Very slow bytea extraction
Date: 2007-03-21 23:01:02
Message-ID: 22731.1174518062@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"msmbarabino(at)virgilio(dot)it" <msmbarabino(at)virgilio(dot)it> writes:
> The test table has 36 records and each bytea field
> contains a 250KB object. A (SELECT byteafield FROM table) takes more
> than 1 minute to execute.

Hm, it takes about 4 seconds here, on a fairly old and slow machine:

$ time psql -A -c "select * from file" regression | wc
38 33699 26653873

real 0m4.00s
user 0m1.37s
sys 0m0.62s

In psql the trick is to use unaligned display mode, else psql itself
eats a whole lot of time trying to nicely format those 250KB rows:

$ time psql -c "select * from file" regression | wc
40 33700 28134681

real 0m57.10s
user 0m53.55s
sys 0m0.67s

I surmise that your problem is likewise on the client side, but you
weren't very specific about what client code you were using. Look
for bottlenecks associated with processing of very wide rows...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message TANIDA Yutaka 2007-03-22 05:03:17 "Relation not found" error but table exits.
Previous Message Tom Lane 2007-03-21 18:13:08 Re: [cstdenis@ctgameinfo.com: Re: BUG #3179: crash when canceling avacuum]