Index creation help

  • 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??

  • 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;-)

  • 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.

  • 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;-)

  • 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
  • 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;-)

  • 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
  • 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)

  • Any suggestions please??

  • 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.

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply