Re: Feature suggestions: "dead letter"-savepoint.

Поиск
Список
Период
Сортировка
От Terje Elde
Тема Re: Feature suggestions: "dead letter"-savepoint.
Дата
Msg-id F533C948-F425-476B-B1EF-6822D95A9F83@elde.net
обсуждение исходный текст
Ответ на Re: Feature suggestions: "dead letter"-savepoint.  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
> On 23 Jun 2016, at 11:50, Marko Tiikkaja <marko@joh.to> wrote:
>
> Comparing these two; how is the latter any better?  It's the same number of commands, except it's holding a
transactionopen for longer, it's using a non-standard concept and it's arguably more complex. 

Same number of commands, but half the number of transactions/commits.  It’s holding the transaction open for longer,
butnot necessarily very long.  It’s also not holding any contested locks (in the example at least). 

It is arguably more complex, but also arguably (imho anyway) simpler.  It gives a generic pattern of saying “I want
thisto happen if things go bad”.  With the upper example, you spend time setting up a system or pattern specifically
forthe use-case.  With patterns such as using a column to mark ownership of a row to your process, you’d need that
extracolumn.  With a large number of rows, and a low probability of actually needing to update the row, that could also
resultin significant update-traffic, that could be avoided.  Similar if you’d need to keep a lock on another table as
well,you’d loose the lock between the first and second transaction.  You could work around that with using
ownership-typecolumns on that table as well, but then you have update-traffic there too.  Not to mention that for any
useof ownership-type columns, you run the risk of having to do housekeeping on them, versus the second example, where
you’resure that all locks get cleaned up. 

I entirely agree though, that this does in no way allow you to solve any new problems, that you can’t solve today.

Part of the reason I like the idea, is that it lowers the threshold for and work involved in dropping in “If what I’m
aboutto do goes badly, I want X to happen”.  Yeah, it’s often comparable to simply do X first, and revert or alter it
later,but that easily leads to twice the commits, loss of locks, having to work around that, possibly introducing even
moreupdate-traffic in the process.  I just see a potential to both avoid that, and gain some developer-comfort at the
sametime, so I figured I should pitch the idea. 

One could easily argue that session-level advisory locks could often be used to avoid the issues of loosing locks
acrossthe two transactions, and it wouldn’t be wrong.  It just moves the question back to complexity though, of which
therewould be more (imho). 


Terje Elde




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

Предыдущее
От: alain radix
Дата:
Сообщение: Re: Requesting external_pid_file with postgres -C when not initialized lead to coredump
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Feature suggestions: "dead letter"-savepoint.