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


Exclude Specific Index From Query


Exclude Specific Index From Query

Author
Message
richardaweiss
richardaweiss
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 328
This is driving me crazy! I want to exclude a specific index from a query but I can not remember how it's done, this may be an undocumented option as I can't seem to find any information about this feature. Does anyone know how to do this?

Thanks!
Igor Micev
Igor Micev
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10196 Visits: 5156
Hi

You can disable an index. Once you disable it, then you have to rebuild it in order to enable it.
If your index is clustered, then after disabling it, your data will be read only and you must rebuild it for update operations.

Regards
IgorMi

Igor Micev,
My blog: www.igormicev.com
GilaMonster
GilaMonster
SSC Guru
SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)

Group: General Forum Members
Points: 219885 Visits: 46279
Could you be a bit more specific about what you're trying to do and why?

If you mean query execution, there's hints to force specific indexes but no hint to ignore certain indexes. Besides, in most cases the optimiser should be left to chose indexes based on its costing of the 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


GilaMonster
GilaMonster
SSC Guru
SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)SSC Guru (219K reputation)

Group: General Forum Members
Points: 219885 Visits: 46279
IgorMi (4/28/2013)
If your index is clustered, then after disabling it, your data will be read only and you must rebuild it for update operations.


Disabling a clustered index prevents all access to the table, read or update, until the index is rebuilt

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


Igor Micev
Igor Micev
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

Group: General Forum Members
Points: 10196 Visits: 5156
GilaMonster (4/28/2013)

Disabling a clustered index prevents all access to the table, read or update, until the index is rebuilt



Correct. Just tried for clustered indexes. And, once you disable a clustered index, all nonclustered are also disabled because they use the clustered one.

Thank You
Regards
IgorMi

Igor Micev,
My blog: www.igormicev.com
richardaweiss
richardaweiss
Valued Member
Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)Valued Member (50 reputation)

Group: General Forum Members
Points: 50 Visits: 328
Thank you all so much for your replies. I wanted to remove a specific index from consideration when SQL Server is compiling it's query plan, kind of like an Option Index <>. This was a purely academic pursuit as I was certain we had done this in the past however, you are of course correct and this is not possible.

Thanks!
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