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


deleting INdexes


deleting INdexes

Author
Message
VastSQL
VastSQL
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20240 Visits: 5558
Hi Experts,

What are precautions and factors need to consider while deleting indexes. We have found more than 500 unused indexes in one of our db and planning to get rid of those.


Please advise.
george sibbald
george sibbald
SSC Guru
SSC Guru (59K reputation)SSC Guru (59K reputation)SSC Guru (59K reputation)SSC Guru (59K reputation)SSC Guru (59K reputation)SSC Guru (59K reputation)SSC Guru (59K reputation)SSC Guru (59K reputation)

Group: General Forum Members
Points: 59048 Visits: 13706
first be sure they are not being used, so remove in a non-prod environment first and test thoroughly.

Avoid removing non-clustered indexes defined as unique. They may not show up as having being used to satisfy queries, but they may be being used instead to enforce a unique constraint.

I presume you are not removing any clustered indexes?

---------------------------------------------------------------------
sqlbuddy123
sqlbuddy123
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16350 Visits: 2243
Also make sure your script those indexes \ backup the database before dropping them. If you have issues later bcs of dropping, then they will come handy.

--
SQLBuddy
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)

Group: General Forum Members
Points: 223843 Visits: 33567
I think SQLBuddy hit the most important point. Backup all the indexes as scripts first. Dropping or adding an index is a pretty trivial event, but knowing exactly which index to add, was it unique, did it have a fill factor or a filter or INCLUDE columns... Backups are the way to go with that.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
MyDoggieJessie
MyDoggieJessie
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27054 Visits: 7488
And here is a pain-free way to script them all out and store them into a table (for safe keeping) :-)
http://www.sqlservercentral.com/scripts/Indexes/101725/

______________________________________________________________________________
Never argue with an idiot; Theyll drag you down to their level and beat you with experience

VastSQL
VastSQL
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20240 Visits: 5558
Thanks George,sqlbuddy,Grant jessie
VastSQL
VastSQL
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20240 Visits: 5558
Thanks George,sqlbuddy,Grant & Jessie
dbassassin
dbassassin
Say Hey Kid
Say Hey Kid (706 reputation)Say Hey Kid (706 reputation)Say Hey Kid (706 reputation)Say Hey Kid (706 reputation)Say Hey Kid (706 reputation)Say Hey Kid (706 reputation)Say Hey Kid (706 reputation)Say Hey Kid (706 reputation)

Group: General Forum Members
Points: 706 Visits: 290
I would check the uptime of the server. Lot's of indexes might seem unused shortly after a reboot. I'm usually hesitant to do any index changes like this until business communicated cycles have completed.

Depending on what you are looking at (0 reads vs. just a few reads), I also check if there are any uses in the plan cache.

If the index is under source control...sweet. If not, get it in there (or script it out), I prefer using Red Gate SQL Source Control and Git

I would then disable the index and eventually by some business approved length of time, drop.

I mention these steps here http://www.codepimp.org/2014/02/source-controlling-indexes/ In order to get SQL Source Control to detect the an index being disabled I had to rename it first.

Why is it that people who can't take advice always insist on giving it? - James Bond, Casino Royale
VastSQL
VastSQL
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20240 Visits: 5558
Thanks SQL4GNT
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