Alvaro Herrera Munoz <alvherre@dcc.uchile.cl> writes:
> Establishing a savepoint is a non-trivial operation (cost-wise). Several
> internal server structures have to be prepared for it.
Check
> It's way cheaper than normal transaction start and commit,
Is it? You have the same amount of work to do (sooner or later) in
terms of updating pg_clog, plus extra work to update pg_subtrans.
And in the abort case it can be worse than aborting a full xact, because
we have to do retail rather than wholesale release of locks, buffers, etc.
I have not had an opportunity to benchmark it but I fear a savepoint may
cost near as much as a full xact in practice.
regards, tom lane