SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Tips On Optimizing Index Performance


Tips On Optimizing Index Performance

Author
Message
Kalpesh-198559
Kalpesh-198559
Valued Member
Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)

Group: General Forum Members
Points: 69 Visits: 1
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/kThaker/tipsonoptimizingindexperformance.asp
Calvin Lawson
Calvin Lawson
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2102 Visits: 102

Good article, but I'd have to disagree with the following:

"Non-Clustered indexes are better for singleton and individual row lookups. "

Non-Clustered indexes really aren't any "better", they costs virtually the same (an index seek vs and clustered index seek) during selects. And when ordering is necessary they can drastically improve performance.

One of the subtle things about SQL is how often is uses ordering.

Also, clustered indexes can help the compiler do optimal joins.

--------------------------------------------------------------------------------------


use pubs


if object_ID('TEST_CL') is not null drop table Test_CL

create table TEST_CL (Name sysname Primary Key)

if object_ID('TEST_NONCL') is not null drop table TEST_NONCL

create table TEST_NONCL (Name sysname,)

create index NC_TEST_NONCL_ID on TEST_NONCL (Name)


declare @Loop int


select @Loop = 0


While @Loop <=100

BEGIN


Insert TEST_CL
select Table_Name + 'test' + cast(@Loop as varchar(25))
from information_schema.tables



Insert TEST_NONCL
select Table_Name + 'test' + cast(@Loop as varchar(25))
from information_schema.tables


set @Loop = @Loop + 1

END


select *
from TEST_CL c0
JOIN TEST_CL c1 on c0.Name = c1.Name


select *
from TEST_NONCL c0
JOIN TEST_NONCL c1 on c0.Name = c1.Name




Signature is NULL
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