Re: Reading over locked rows
Posted in 1995
> i've a program which unload tables to an ascii file and updates a > specific > column in the rows after they are written to the file. > > Isolation mode is set to repeatable read to avoid rows to be written to > the > file which are not committed. > > Everything was fine but if there are open transactions over some rows of > a > table i got repeated errors in the range -242 to -246 (depends if the > table is > indexed or not) until all transactions for this table are completed. Is > there a > way to "jump" over the locked rows? The whole point of raising your isolation level is to (a) place a share lock on everything you read (in practice everything you touch, hence it making a difference whether there is an index) and (b) prevent you reading anything which anyone has an exclusive lock on. Have a look in Chapter 7 of the Guide to SQL: Tutorial if you want to understand better how it all works. If you want to wait for people to commit transactions before reading a row you could always try setting lock mode to wait, that way you'd read the correct, committed data eventually but the danger is you could be hanging around for a painfully long time. The best solution is usually a combination of shortening the transactions of the processes that own the X-locks, and setting LOCK MODE TO WAIT n(seconds), where n is the longest you'd ever expect an exclusive lock-acquiring transaction to be open and should be as short as possible. akent@cix.compulink.co.uk (Andy Kent) ------------------------------------------------ Freelance Informix Database Specialist, Redland, Bristol, England