Re: Universal Server - Row Locking Problem
Posted in 1998
Frido van Orden wrote: > > Yes, this is a classic one! > > THe problem is that you don't have an index on this table. As you issue the > second update statement, IUS starts looking for a record with col_id = 2. As > no index is available, it just starts looping through all the records until > it finds the right one. Because the row you updated with the first statement > was also the first row inserted into the table, it will find that one first > and try to evaluate the condition 'col_id = 2'. However, the row is locked > by some other session, hence the error message. > > If you don't believe this: change the first update to 'col_id = 2' and the > second one to 'col_id = 1'. Now things will work fine! No, this should still fail. Just because the second update found the first row where col_id=1 doesn't mean it stops searching. If you don't have an index, how would it know that there is only one row where col_id=1? It should continue to search the table for more rows where col_id=1, go to the second row, which is locked, try to evaluate the condition, and fail. > Relational theory says something about 'Physical Data Independency' which > means that the precense or absence of indexes, mirroring and stuff should > not affect the behaviour of your programs. If only theory would be > reality.... Your program will behave the same, it will just have to wait for the other person to finish. -- June ---- June Tong Informix Software ---- ---- Senior Consultant (650) 926-6140 ---- ---- International Support junet@informix.com ---- ---- Location-du-jour: Menlo Park ----