Concurrency in a multi-user environment



Hi,

I'm been googling to see if I can find information on how programmers handle
concurrency in a multi-user PHP/MySQL environment. Here's a snippet of my
app.

I have a form where users can maintain client information such as Name,
Address, telephone, email, etc.... I've been wondering how to handle a
situation where two users are editing the same record.

One idea is to lock the record when User A enters but this may make it
inaccessible for a long period if User A decided to get up and leave for a
three hour lunch. Also, does locking a record prevent file locks (when new
records need to be added)? Finally, locking a record means I have to
convert from MyISAM to InnoDB but this is probably necessary for
concurrency.

Another idea is to use a semaphore where User A enters and retrieves a
numeric field in the table. Upon leaving, the user locks and checks if the
field is the same value. If yes, save, increment the numeric field and
leave. If not, it indicates another user entered has edited, saved and
left. I'm not crazy about this as it would mean User A could spend 15
minutes updating a record only to get a message that User B already edited
it.

Does anyone have any user friendly suggestions or can give me some URLs
where I can read up on this?

Thanks,
Don
.



Relevant Pages

  • Urgent: Concurrency in SQL Server 2005: How to use granularity of Locks in Snapshot isolation level
    ... I have developed a VS 2005 database application which has the concurrency ... Locking granularity (database, table, [age, row, ... Versioning (snapshot isolation, read committed ... I would like to use the granularity of locks (rows or index ...
    (microsoft.public.sqlserver.clients)
  • Re: Locking of nodes in tree for concurrent access
    ... Some item is categorized by N criterias (a criteria is the value ... number of concurrent accesses of the tree), ... For a good understanding of Java concurrency in practice, ... Java 6 has much more efficient handling of locks than earlier versions. ...
    (comp.lang.java.programmer)
  • Re: How to update multiple rows atomically
    ... As has been said before numerous times, shared state concurrency ... It was really only a matter of re-thinking the schemas for a few high-frequency 'tables' and using very selective locking for the high-frequency transactions that the back-office ones were competing with. ... The sequence of user actions is often pre-ordained, implying that certain locks make other locks redundant. ... No experience with so-called concurrent languages nor massive internet systems but I imagine the basic techniques are similar, eg., think of an app that has both high-use and intensive functions as two apps, imagine separate schemas and then make a combination that marries them. ...
    (comp.databases.theory)
  • Re: Indexes and Logical design
    ... "One can easily imagine a unique constraint ... which results in coarser locks and degraded concurrency. ... where updates lead to creating new versions of tuples, ...
    (comp.databases.theory)