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 -- 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
