Re: Optimistic concurrency control

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Optimistic concurrency control
Дата
Msg-id 20050113104905.GA7067@svana.org
обсуждение исходный текст
Ответ на Optimistic concurrency control  ("Frank Millman" <frank@chagford.com>)
Список pgsql-general
On Thu, Jan 13, 2005 at 11:49:00AM +0200, Frank Millman wrote:
> I have been reading up on 'optimistic concurrency control'.
>
> The following quote is taken from the on-line help for MS SQL Server 2000 -

<snip>

> MS SQL Server uses a 'timestamp' column to check if a row has been
> altered since it was read. The equivalent in PostgreSQL seems to be
> the system column 'xmin'. However, the notes say 'You do not really
> need to be concerned about these columns, just know they exist.' Is
> it ok to use xmin for this purpose, or is there another way of
> achieving OCC?

PostgreSQL already has concurrency control, it's called MVCC, so within
a transaction you will only see a consistant version of the database
without taking any locks. If you want to emulate it on top of that
on over multiple transactions, remember xmin represents the transaction
that created it, not the timestamp it was changed. If you really want
timestamps you'll need to manage that yourself...

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: Peter Childs
Дата:
Сообщение: Re: problems with 8.0 Rc4
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Optimistic concurrency control