On 07/12/10 21:33, Andres Freund wrote:
> On Tuesday 07 December 2010 20:17:57 Jan Urbański wrote:
>> * execute SPI calls in a subtransaction, report errors back to Python
>> as exceptions that can be caught etc.
> Youre doing that unconditionally? I think the performance impact of this will
> be too severe... Subtransactions can get quite expensive - especially in the
> face of HS.
See
http://www.mail-archive.com/pgsql-hackers@postgresql.org/msg163004.html :(
>> * explicit subxact starting, so you can issue consecutive plpy.execute
>> calls atomically
> That likely obsoletes my comment from above.
Not really, I'm afraid :( You can pay the subxact overhead once with
explicit subxact starting, but you always have to pay it...
with plpy.subxact(): plpy.execute("select 1") plpy.execute("select 2") plpy.execute("select 3")
will start only 1 subxact, as opposed to 3.
Cheers,
Jan