BUG #4414: PQescapeByteaInternal very slow/inefficient
| От | Rudolf Leitgeb |
|---|---|
| Тема | BUG #4414: PQescapeByteaInternal very slow/inefficient |
| Дата | |
| Msg-id | 200809101112.m8ABCwxg080817@wwwmaster.postgresql.org обсуждение исходный текст |
| Ответы |
Re: BUG #4414: PQescapeByteaInternal very slow/inefficient
|
| Список | pgsql-bugs |
The following bug has been logged online:
Bug reference: 4414
Logged by: Rudolf Leitgeb
Email address: r.leitgeb@x-pin.com
PostgreSQL version: 8.3.3
Operating system: Mac OSX, linux
Description: PQescapeByteaInternal very slow/inefficient
Details:
PQescapeByteaInternal uses sprintf to convert a byte to its octal
representation, which slows down escaping of large BLOBs significantly. A
simple replacement table could achieve the same effect with much better
performance with only minimal extra memory requirements.
The routine is located in fe-exec.c
The call
(void) sprintf((char *) rp, "\\%03o", *vp);
could be replaced by
memcpy((char *)rp, lookuptable[*vp]);
rp += otherlookuptable[*vp];
with a properly configured lookuptable and otherlookuptable.
В списке pgsql-bugs по дате отправления: