incrementing updates and locks - Mailing list pgsql-admin

From Aras Angelo
Subject incrementing updates and locks
Date
Msg-id AANLkTinQ-A9oPExCgmwWv5br9+kmvnZVCBNhdLzED_qK@mail.gmail.com
Whole thread Raw
Responses Re: incrementing updates and locks
Re: incrementing updates and locks
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bidirectional index traversal
Next
From: "Daniel J. Summers"
Date:
Subject: Re: incrementing updates and locks