Re: BUG #2236: extremely slow to get unescaped bytea data

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Kalador Tech Support <support(at)kalador(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2236: extremely slow to get unescaped bytea data
Date: 2006-02-08 06:58:39
Message-ID: 20060208065839.GA18717@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Feb 04, 2006 at 04:06:11PM -0800, Kalador Tech Support wrote:
> I've since isolated the problem to the unescape_bytea function not the
> SELECT.
>
> I inserted the same image to a bytea column using base64 encoding, and
> extracted it from the table (using base64 decoding) and this worked very
> fast (<1 second). So, it is the unescape_bytea function that is to blame.

pg_unescape_bytea is fast here; I just unescaped an 850K jpeg image
in about 0.18 seconds on a slow (500MHz) machine.

How did you determine that pg_unescape_bytea was the problem? What
does something like the following show?

$tstart = microtime(true);
$data = pg_unescape_bytea(pg_fetch_result($res, 'data'));
$dt = microtime(true) - $tstart;
header("Content-Type: text/plain");
printf("unescape time = %.3fms, %d bytes\n", $dt * 1000.0, strlen($data));

--
Michael Fuhr

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2006-02-08 13:46:59 Re: BUG #2246: Bad malloc interactions: ecpg, openssl
Previous Message Andy Klosterman 2006-02-07 20:15:45 BUG #2246: Bad malloc interactions: ecpg, openssl