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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kalador Tech Support <support(at)kalador(dot)com>, Michael Fuhr <mike(at)fuhr(dot)org>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2236: extremely slow to get unescaped bytea data
Date: 2006-02-09 15:46:46
Message-ID: 20060209154646.GK5234@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> Kalador Tech Support <support(at)kalador(dot)com> writes:
> > When run from a browser, accessing an Apache webserver, the results
> > displayed were:
>
> > fetch time = 3.632ms, 296043 bytes
> > unescape time = 70625.518ms, 296043 bytes
>
> Is it possible that you are relying on an old (like 7.3) libpq?
> I find this in the CVS logs:
>
> 2003-06-11 21:17 momjian
>
> * src/interfaces/libpq/fe-exec.c: I found the libpq function
> PGunescapeBytea a little slow. It was taking a minute and a half to
> decode a 500Kb on a fairly fast machine. I think the culprit is
> sscanf.
> ...
> The new function is significantly faster on my machine with the
> JPEGs being decoded in less than a second. I attach a modified
> libpq example program that I used for my testing.

I note in the PHP 4 sources that the PQunescapeBytea function seems to
have been copied there, "for the benefit of PostgreSQL 7.2 users". It
says that it comes from 7.3 but I don't see any sscanf call.

There is no PQunescapeBytea call in the whole source that I can see, so
my guess is that the libpq function is not called at all. So this may
be a PHP bug rather than a Postgres bug.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Magnus Hagander 2006-02-09 15:50:16 Re: BUG #2248: Fix for terminal server
Previous Message Kris Jurka 2006-02-09 15:46:39 Re: BUG #2249: unsupported frontend protocol