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


Query Cost 27%


Query Cost 27%

Author
Message
Alone
Alone
SSC Rookie
SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)

Group: General Forum Members
Points: 45 Visits: 287
How to change non clustered index scan to non clustered index seek?The concerned tables already have non clustered index configured.
Lynn Pettis
Lynn Pettis
SSC-Dedicated
SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)SSC-Dedicated (39K reputation)

Group: General Forum Members
Points: 39876 Visits: 38563
Alone (5/15/2012)
How to change non clustered index scan to non clustered index seek?The concerned tables already have non clustered index configured.


I have no idea based solely on what you have posted. With no information regarding the query, table or tables involved, the indexes defined, or the actual execution plan all you are going to get is ignored or wild shots in the dark that may not even be useful.

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)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

Group: General Forum Members
Points: 88351 Visits: 45281
Please post query, execution plan, table definition, index definition.

Also, ask yourself if the scan is a problem before you spend any time thinking about it.
http://sqlinthewild.co.za/index.php/2010/03/11/the-root-of-all-evil/

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


Evil Kraig F
Evil Kraig F
SSCrazy Eights
SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)

Group: General Forum Members
Points: 8643 Visits: 7660
Alone (5/15/2012)
How to change non clustered index scan to non clustered index seek?The concerned tables already have non clustered index configured.


Typically? You don't. A seek happens when the data and the filter are selective enough. To get close to guaranteeing a seek you'd need a filter roughly on par with a single day in a year, with even distribution. Even then it would depend on how the index is setup and what your where clause looked like.

After that you're dealing with data volume and tipping points and row width and a number of other factors.

Schema, Actual Execution Plan, and the T-SQL would help us help you here.


- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87330 Visits: 41113
Evil Kraig F (5/15/2012)
Alone (5/15/2012)
How to change non clustered index scan to non clustered index seek?The concerned tables already have non clustered index configured.


Typically? You don't. A seek happens when the data and the filter are selective enough. To get close to guaranteeing a seek you'd need a filter roughly on par with a single day in a year, with even distribution. Even then it would depend on how the index is setup and what your where clause looked like.

After that you're dealing with data volume and tipping points and row width and a number of other factors.

Schema, Actual Execution Plan, and the T-SQL would help us help you here.


Gosh... if all that were true, it wouldn't be worth having things like calendar tables.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32741 Visits: 18559
GilaMonster (5/15/2012)


Also, ask yourself if the scan is a problem before you spend any time thinking about it.


+1 Cool



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Evil Kraig F
Evil Kraig F
SSCrazy Eights
SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)

Group: General Forum Members
Points: 8643 Visits: 7660
Jeff Moden (5/15/2012)

Gosh... if all that were true, it wouldn't be worth having things like calendar tables.


Alright, I'll bite into that one... there's nothing in there I see as being inaccurate, how did a calendar table get involved?

The only piece of that which is a generality is the 1 day in a year bit for seek vs. scan guarantees, and perhaps I should have been more clear. 0.03 is the 'near guarantee' mark, which is roughly 1/300... for round numbers I use one day in a year. It CAN scan before than, but you're not guaranteed.


- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87330 Visits: 41113
Evil Kraig F (5/16/2012)
Jeff Moden (5/15/2012)

Gosh... if all that were true, it wouldn't be worth having things like calendar tables.


Alright, I'll bite into that one... there's nothing in there I see as being inaccurate, how did a calendar table get involved?

The only piece of that which is a generality is the 1 day in a year bit for seek vs. scan guarantees, and perhaps I should have been more clear. 0.03 is the 'near guarantee' mark, which is roughly 1/300... for round numbers I use one day in a year. It CAN scan before than, but you're not guaranteed.


Are you suggesting that if I use something like a tenth of a table that a scan is virtually guaranteed?

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
GilaMonster
GilaMonster
SSC Guru
SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

Group: General Forum Members
Points: 88351 Visits: 45281
Jeff Moden (5/16/2012)
Are you suggesting that if I use something like a tenth of a table that a scan is virtually guaranteed?


If you are using a non-covering index, then absolutely yes. The tipping point (where using a noncovering index and doing key lookups is less efficient than a table scan) is somewhere around 0.5% of the total rows in the table (it's ~ number of rows = 30% of the number of pages in the table)

There's a post on my blog "Seek or Scan" which shows this. Sorry, don't have time to find it, got to get to class.

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


Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)SSC Guru (87K reputation)

Group: General Forum Members
Points: 87330 Visits: 41113
Thanks, folks... I'll take a deeper look.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
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