Re: Does psql use nested transactions?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Does psql use nested transactions?
Дата
Msg-id 20040818004859.GA8017@dcc.uchile.cl
обсуждение исходный текст
Ответ на Re: Does psql use nested transactions?  (Haroldo Stenger <haroldo.stenger@gmail.com>)
Список pgsql-hackers
On Tue, Aug 17, 2004 at 08:21:13PM -0300, Haroldo Stenger wrote:

Hola,

> On Tue, 17 Aug 2004 16:58:56 -0400, Alvaro Herrera Munoz
> <alvherre@dcc.uchile.cl> wrote:

> > Establishing a savepoint is a non-trivial operation (cost-wise).  Several
> > internal server structures have to be prepared for it.  It's way cheaper than
> > normal transaction start and commit, but undesirable anyway if done once per
> > query.  Worse if it's going to be seldom used.
> 
> I see. So, any heavy use of savepoints, say, issuing one before each
> SQL command that might violate a restriction, would worsen a lot the
> performance of my application?

It depends.  If you are going to establish savepoints just for the sake
of it, and later release them, then yes --- there is no point in
incurring in the overhead (and your application will be slower).  But if
the application has any chance to fail within the savepoint, and you can
rollback to a savepoint to retry in a situation which would normally
force you to rollback a transaction and start again, then you could
_win_ performance.

-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"I personally became interested in Linux while I was dating an English major
who wouldn't know an operating system if it walked up and bit him."
(Val Henson)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Philip Warner
Дата:
Сообщение: Re: Does psql use nested transactions?
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Does psql use nested transactions?