Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Isolation level and Index


Isolation level and Index

Author
Message
S-322532
S-322532
SSC-Enthusiastic
SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)

Group: General Forum Members
Points: 143 Visits: 268
Hi,

Is there any relationship between isolation level and indexes ?

How indexes affect the use of isolation level ?

Is there any performance boost-up obtained during data retrieval using where clause when isloation level is implemented on a table with indexes ?

Alien Alien Alien

Can any one explain in detail ? Links and resources would be of great help Hehe

Thanks,

Sree
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47295 Visits: 44392
No relationship.

Isolation levels affect how long locks are kept within a transaction and how isolated changes made by one transaction are from another transaction.

Indexes speed up data retrieval by giving the query processor a fast way to find rows affected by queries.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


S-322532
S-322532
SSC-Enthusiastic
SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)SSC-Enthusiastic (143 reputation)

Group: General Forum Members
Points: 143 Visits: 268
Hi GilaMonster,

Thanks for the reply Smile

Can u plz go thro the below paragraphs and offer me your valuable guidance/suggestions.

When i tried to explore isolation levels i found the below stuff.

The following statements are executed to test READCOMMITTED isolation level

CREATE TABLE Consultants (
ConsultantID INT IDENTITY,
ConsultantName VARCHAR(20),
Technology VARCHAR(15),
HireDate DATETIME,
HourlyRate MONEY)

---------------------------------------------------------------------
-- Fill some data
---------------------------------------------------------------------
INSERT INTO Consultants (ConsultantName, Technology, HireDate, HourlyRate)
SELECT 'Jacob', 'SQL Server', '2000-10-03', 120
INSERT INTO Consultants (ConsultantName, Technology, HireDate, HourlyRate)
SELECT 'Smith', 'ASP.NET', '2005-01-01', 140000
INSERT INTO Consultants (ConsultantName, Technology, HireDate, HourlyRate)
SELECT 'Michael', 'C#.NET', '2002-10-30', 80000


I executed the following statements in Query Window 1

BEGIN TRAN
UPDATE c SET
HourlyRate = 250
FROM Consultants c
WHERE ConsultantName = 'Smith'



When execcuted the following statements from Query Window 2

select * from Consultants

the query blocks and does not return. This query blocks with the transaction running on
the other session. Now move back to Query Window 1 and COMMIT the transaction.

COMMIT TRAN

Now switch back again to Query Window 2. You will notice that the query returned the following.
/*
ConsultantID ConsultantName Technology HireDate HourlyRate
------------ -------------------- --------------- ----------------------- ---------------------
1 Jacob SQL Server 2000-10-03 00:00:00.000 120.00
2 Smith ASP.NET 2005-01-01 00:00:00.000 250.00
3 Michael C#.NET 2002-10-30 00:00:00.000 100.00
*/

I then created a clustered index on the ConsultantID column.

ALTER TABLE Consultants
ADD CONSTRAINT PK_Consultants PRIMARY KEY (ConsultantID)

Now move to Query Window 1 and update the record of Smith.

BEGIN TRAN
UPDATE c SET
HourlyRate = 250
FROM Consultants c
WHERE ConsultantName = 'Smith'

Now, Move to Query Window 2 and run the following queries.

SELECT *
FROM Consultants
WHERE ConsultantID = 3

/*
ConsultantID ConsultantName Technology HireDate HourlyRate
------------ -------------------- --------------- ----------------------- ---------------------
3 Michael C#.NET 2002-10-30 00:00:00.000 100.00
*/

Now, the thing i want to know is that "is still something
there to know more about isolation levels in connection with indexes ?"


N.B: the above code and observations were obtained from the following URL
http://www.sqlserverandxml.com/2008/08/sql-server-transaction-isolation-level.html


Thanks and Regards,

Sree
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47295 Visits: 44392
Without indexes SQL has to do table scans and hence will take table-level locks. With appropriate indexes, SQL can take more granular locks and hence the two connections don't block each other.


Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search