locking on database updates
От | Gary Stainburn |
---|---|
Тема | locking on database updates |
Дата | |
Msg-id | 01BF400D.C8C88440@garys.ringways.co.uk обсуждение исходный текст |
Ответы |
Re: [INTERFACES] locking on database updates
Re: [INTERFACES] locking on database updates |
Список | pgsql-interfaces |
Hi All, I have a number of tables in my database where the key is an int4 into which I place a unique sequential number. I havelearned from part experience (although not on pgsql) not to use auto-generated numbers as it makes it a nightmare torebuild corrupted databases. I then have a parameter table with a single row in it containing the next available number for each table. There will eventuallybe approx 140 users on this database accessing from web browsers (apache->perl using CGI.pm and DBI/DBD::Pg) andthe main table will be hit quite hard. My question is this. Is there a safe way of retrieving the next number from the parameter table in such a way that the samenumber cannot be retrieved twice Pseudo Code Select & lock record increment number Update record Unlock record ....... ----------------------------------------- Gary Stainburn. Work: http://www.ringways.co.uk gary.stainburn@ringways.co.uk REVCOM: http://www.revcom.dhs.org http://www.revcom.org.uk gary.stainburn@revcom.org.uk ----------------------------------------- The nice thing about standards is that there are so many of them to choose from. -- Andrew S. Tanenbaum -----------------------------------------
В списке pgsql-interfaces по дате отправления: