Re: PQgetlength vs. octet_length()

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: PQgetlength vs. octet_length()
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C203937ED1@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на PQgetlength vs. octet_length()  (Michael Clark <codingninja@gmail.com>)
Список pgsql-general
Michael Clark wrote:
> That is what Pierre pointed out, and you are both right.  I
> am using the text mode.
>
> But it seems pretty crazy that a 140meg bit of data goes to
> 1.3 gigs.  Does that seem a bit excessive?
>
> I avoided the binary mode because that seemed to be rather
> confusing when having to deal with non-bytea data types.  The
> docs make it sound like binary mode should be avoided because
> what you get back for a datetime varies per platform.

That is true.

The best thing would be to retrieve only the bytea columns in
binary format and the rest as text.

The Bind message in the frontend/backend protocol allows to
specify for each individual result column whether it should
be text or binary
( http://www.postgresql.org/docs/current/static/protocol-message-formats.html )
but the C API only allows you to get *all* result columns in either
binary or text.

You could resort to either speaking line protocol with the backend,
(which is probably more than you are ready to do), or you could
create a separate query only for the bytea value.

Yours,
Laurenz Albe

В списке pgsql-general по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Idle processes chewing up CPU?
Следующее
От: "Andrus Moor"
Дата:
Сообщение: pg_restore returns always error if backup is greater than 2 GB