A Dilluns, 15 d'agost de 2011 08:54:03, Albert Cervera i Areny va escriure:
> A Dimarts, 17 de maig de 2011 12:33:55, Cédric Krier va escriure:
> > On 16/05/11 13:26 +0200, Cédric Krier wrote:
> > > The Async method will be in charge of setting a new cursor for the
> > > thread, creating a thread and keep the result until the main thread
> > > will read it. Of course, for backend that doesn't support
> > > multi-threading, the method will do the query directly.
> > 
> > Semi-bad news, I made some tests and the queries with threaded cursor are
> > serialized (indeed it was in the doc :-). This means that the gain will
> > be only on the parallelism of SQL queries and Python code.
> 
> We might want to keep an eye on this patch [1] which allows several
> transactions "see" the same data even if they're in different sessions. I
> think it is the way to go (although threads should be read-only IMHO). It
> should be easy to encapsulate and may improve performance in the cases
> Cédric mentioned. We just need to wait to see if the patch gets commited
> eventually and if it did, it would not be available until PostgreSQL 9.2
> which is due in more than a year.
> 
> [1] http://archives.postgresql.org/pgsql-hackers/2011-08/msg00684.php

The patch has eventually been commited. Here are the docs:

http://developer.postgresql.org/pgdocs/postgres/functions-
admin.html#FUNCTIONS-SNAPSHOT-SYNCHRONIZATION
http://developer.postgresql.org/pgdocs/postgres/sql-set-transaction.html

I think this can be used to achieve what Cédric wanted. Even if it will only 
be available since PostgreSQL 9.2, the Async API could simply behave 
synchronously if version is < 9.2.

-- 
Albert Cervera i Areny
http://www.NaN-tic.com
Tel: +34 93 553 18 03

http://twitter.com/albertnan 
http://www.nan-tic.com/blog

-- 
[email protected] mailing list

Reply via email to