incrementing updates and locks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux