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


Index creation help


Index creation help

Author
Message
sandyinfowave
sandyinfowave
Old Hand
Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)

Group: General Forum Members
Points: 344 Visits: 1092
I was analysing an execution plan before and after creation of an index. Disk IO decreased considerably after creation of index but overall operation cost increased(because of lookups)...How do we generally determine if a index was helpful??
Bhuvnesh
Bhuvnesh
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13506 Visits: 4077
sandyinfowave (11/8/2013)
but overall operation cost increased(because of lookups)...
try to implement covering index on non clustered indexes to remove lookups.

sandyinfowave (11/8/2013)
How do we generally determine if a index was helpful??

When time, cpu, io, memory cost get reduced.

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)

Group: General Forum Members
Points: 96395 Visits: 38981
First, be careful with making a covering index. Depending on how many columns of data and their sizes may make a covering index quite large. If this is also an active OLTP system maintaining the index may be more expensive than the bookmark lookups.

One thing to look at is the elapsed time of the procedure before and after creating the index.

The cost values you see in the execution plan are basically arbitrary values. You really can't use those by themselves to determine how efficient or inefficient a plan may be.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Bhuvnesh
Bhuvnesh
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13506 Visits: 4077
Lynn Pettis (11/11/2013)
The cost values you see in the execution plan are basically arbitrary values.
Does this the same case with profiler trace stats too?

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)

Group: General Forum Members
Points: 228323 Visits: 46342
Bhuvnesh (11/11/2013)
Lynn Pettis (11/11/2013)
The cost values you see in the execution plan are basically arbitrary values.
Does this the same case with profiler trace stats too?


Profiler trace doesn't show optimiser costs anywhere.

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


Bhuvnesh
Bhuvnesh
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13506 Visits: 4077
GilaMonster (11/11/2013)
Bhuvnesh (11/11/2013)
Lynn Pettis (11/11/2013)
The cost values you see in the execution plan are basically arbitrary values.
Does this the same case with profiler trace stats too?


Profiler trace doesn't show optimiser costs anywhere.
ohh.. i thought (What lynn mentioned) here cost values are basically values of cpu, io, time etc ?

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)SSC Guru (228K reputation)

Group: General Forum Members
Points: 228323 Visits: 46342
No, those are CPU times, number of IOs and execution times. Costs are what the optimiser calculates, what you see in query plans.

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


sandyinfowave
sandyinfowave
Old Hand
Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)

Group: General Forum Members
Points: 344 Visits: 1092
Thanks for your valuable suggestions...I didn't create a covered index as the number of columns in include statement are more( & table has around 40 million records), didn't want to spend too much time/resources in maintaining index's. I forced the query to use an already existing index(using with index statement) which prevents table scans. Is it advisable to force the query to use an index. I guess sql server should already choose best execution plan based on available indexes right??

I also see Hash Match's in my execution plan..What are these??

So analysing the elapsed time is the only option to decide whether an index is helpful??? (not sure how accurate it is as the SP can be cached)


P.S: elapsed time decreased considerably(almost decreased to 1/4th) after making these changes, but higher than what it used to be in the past(3-4 months ago when the query was running faster)...Not sure what changes happened but it forced me to analyse execution plan

These queries are used for our reporting purposes(to insert data into Reporting tables)
sandyinfowave
sandyinfowave
Old Hand
Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)Old Hand (344 reputation)

Group: General Forum Members
Points: 344 Visits: 1092
Any suggestions please??
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)SSC Guru (96K reputation)

Group: General Forum Members
Points: 96395 Visits: 38981
Not much more we can do with as little information as you have provided. Please read the second article I reference below in my signature block. It will walk you through what you need to post and how to do it.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
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