Re: contrib: hack for psycopg2 performance

Michael Tharp <gxti-1pawZKhx9Om5WRpDikjj11aTQe2KTcn/@public.gmane.org> Wed, 12 May 2010 13:04:55 -0400
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 05/10/2010 05:54 PM, Daniele Varrazzo wrote:
> PQexecParams has the shortcoming of being able to send only a query at
> time, whereas PQexec allows to send any number in a single string,
> separated by semicolons. Many people use this feature and dropping it
> would be an incompatible change. How would you work around that?

Can you "pipeline" statements in libpq? e.g. send three statements as 
separate commands but without waiting for the replies to the first two.

Obviously any completely transparent replacement, regardless of 
implementation, would need to be able to parse enough SQL to reliably 
split statements. I don't suppose that would be terribly difficult 
because SQL quoting rules are fairly simple, but it's still more work to 
be done.

Also this will break everyone's custom typecasters, which will need some 
way to do whatever formatting is required for parameterized values. That 
said, I'm kind of interested in seeing where this goes.

Maybe this is the motivation I need to read up on how libpq works. I've 
hacked on postgres, but never actually used the client library except 
though Python...

-- m. tharp