Re: Using real libpq parameters
От | P. Christeas |
---|---|
Тема | Re: Using real libpq parameters |
Дата | |
Msg-id | 201102271230.46901.p_christ@hol.gr обсуждение исходный текст |
Ответ на | Using real libpq parameters (Daniele Varrazzo <daniele.varrazzo@gmail.com>) |
Ответы |
Re: Using real libpq parameters
|
Список | psycopg |
On Sunday 27 February 2011, Daniele Varrazzo wrote: > Hello, > > I've tried to make order in the ideas about pros and cons of using > real query parameters in libpq. Here is my analysis and a possible > plan. > ... Sorry not to have answered this thread earlier, I've had some trouble with kmail+akonadi which kept me silent for a couple of days :S Yes, we have /already/ done a few experiments on using binary data types with psycopg2. A few remarks (merely what Daniele has said): 1. When used properly, binary datatypes have significant speed gain over text ones. But not in all cases. 2. Not all datatypes can go binary. That's not a problem in the send direction, because we can control that with a boolean flag. 3. There is NO universally backwards compatible way of switching from text params to binary ones. If we ever support binary, it will need an explicit attribute/method, like the ISQLParam adaptation that Daniele has proposed. Since breaking compatibility of psycopg2 is out of the question, so is moving to binary mode by default. 4. In the receive direction, things are even more complex. It wouldn't be recommended except for cases of extreme data transfers (always with the option to fall back to the old text code). 5. libpqtypes doesn't seem to help as you suggested. It does text->net-bin adaptations, which we don't need, since Python internal representation is already binary. We want a bin->net-bin library (where net-bin is the network Postgres-native format of data, heavily dependent on server's version).. OTOH, reading the code of libpqtypes /could/ help us write ourselves similar adapters. Code at: http://git.hellug.gr/?p=xrg/psycopg2;a=shortlog;h=refs/heads/execparams -- Say NO to spam and viruses. Stop using Microsoft Windows!
В списке psycopg по дате отправления: