incrementing updates and locks

Поиск
Список
Период
Сортировка
От Aras Angelo
Тема incrementing updates and locks
Дата
Msg-id AANLkTinQ-A9oPExCgmwWv5br9+kmvnZVCBNhdLzED_qK@mail.gmail.com
обсуждение исходный текст
Ответы Re: incrementing updates and locks
Re: incrementing updates and locks
Список pgsql-admin
Hello All

I have a column in my table which is incrementally updated. I cant set this field to be a SERIAL because the value is not assigned at the time of the INSERT, it is assigned later by the system by an UPDATE.
Whats the best way to achieve this by means of performance? Should i set the MAX variable in a different table, and query that table and assign the next value to the actual table every time there is an UPDATE going? That means a SELECT to the max number holder table, UPDATE to the actual table, and an UPDATE to the max_holder table again. That probably would slow down the process but i cant think of a better way.

Lets say a client updates 30 in a batch, i dont think i can do one SELECT max_number and increment that number with the programming language independent from the DB because several clients access the database synchronously.

Also should i be worried about LOCKING the tables, or UPDATE statements already does a lock itself?

Sorry if i could not make it clear enough.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Bidirectional index traversal
Следующее
От: "Daniel J. Summers"
Дата:
Сообщение: Re: incrementing updates and locks