Sybase ASE Isolation levels and Locking

Environment:

ASE 12.5.4 Linux 64 Bit

I am confused about the behaviour of the following:

If my T-SQL session's transaction Isolation level is 1 - Read Committed and I start a transaction and update a table. I should be able to Select data from the same table with out being blocked.

However my select statement waits until I commit or rollback,
sp_lock show Ex_Page and Ex_intent Locks on the datatable (select * from sysobjects)

It seems to be operating at Isolation Level 3 regardless.
kyleitvssAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jan FranekCommented:
Isolation level 1 doesn't mean, that you will ignore exclusive locks. It only guarantees, that you will not see uncommited data.

If you don't want to be blocked by exclusive locks of other processes, you may try to use READPAST (see http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__BookTextView/55452). However, this way you may not see complete data (as locked pages or rows will be skipped).

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joe WoodhousePrincipal ConsultantCommented:
Building on Jan's answer, the behaviour you describe is correct and expected. By setting your isolation level to 1, you are saying you only want to see data that is committed. Making you wait for a commit or rollback before you see data updated in a transaction is providing you with exactly what you asked for - you are only ever getting results returned from committed data, exactly as isolation level 1 requires.

Since you mentioned isolation level 3, I'll explain that a bit more: isolation level 3 says all read locks should be held for the duration of the transaction they are in, which guarantees no other processes can write to those pages, which in turn guarantees each time you re-read those pages (in the same transaction) you will always see the same results. That's a repeatable read, which is what isolation level 3 is all about. Your scenario is actually unrelated - with repeatable reads, reads block writes, whereas your situation is a writer blocking a read, which they do in every isolation level except 0.
0
kyleitvssAuthor Commented:
Thank you both for you quick response
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Sybase Database

From novice to tech pro — start learning today.