[Libpqxx-general] Exec query with binary parameters

Jeroen Vermeulen jtv at xs4all.nl
Fri Apr 3 15:24:13 UTC 2009


Maurice Gittens wrote:

> I feel pqxx should simply support binary data because the C libraries
> support it. This should be sufficient proof that in the eyes of the 
> Postgresql designers
> support for binary database is worthwhile.
> 
> The reasons given for not supporting them seem like a lame cop out to 
> me. It goes like:

That page is about why *general* binary transfers will not be supported; 
sending natively "raw binary" data is a different matter.  And one 
that's already supported in libpqxx.

Part of what the page says is what the core postgres developers 
themselves tell people who ask about binary transfers, using any client 
API.  Argue with them if you think you know better--but unless you have 
something much smarter to say than you have so far, I wouldn't.

Michael, is the performance improvement you're seeing compared to plain 
INSERT statements?  There are much faster ways to insert data:

1. There's tablewriter if you're writing many rows in one go.  It saves 
a lot of network traffic, statement parsing etc.

2. Prepared statements.  Those do support binary parameters.

3. Large objects.  This API provides a file-like interface to blobs.  I 
don't think it's still the preferred way of handling binary data though, 
now that the old limits on row sizes are gone.


Jeroen


More information about the Libpqxx-general mailing list