?
Solved

What is the fastest way to remove the index on Column A and C but keep the index on column B

Posted on 2011-02-24
4
Medium Priority
?
391 Views
Last Modified: 2012-05-11
I have a table with columns A, B, and C, where a unique clustered index exists on column A, a unique non-clustered index exists on Column B, and a non-unique non-clustered index exists on column C.  Assuming there are 100 million records in this table, what is the fastest way to remove the index on Column A and C but keep the index on column B?
0
Comment
Question by:tesla764
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Expert Comment

by:tigin44
ID: 34971382
use
drop index

this will drop indexes one by one...
0
 
LVL 26

Expert Comment

by:tigin44
ID: 34971421
an example syntax for drop index is

IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[tableName]') AND name = N'indexName')
DROP INDEX [ndexName] ON [dbo].[tableName] WITH ( ONLINE = OFF )
GO
0
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 34971489
If you have an index on columns A,B,C and you want it only on column B then do following:

Add new index with ONLINE = ON on column B so you don't lock the table; you may want to look at SORT_IN_TEMPDB = ON and MAXDOP = 1 if you have a huge table indeed and is used on line.

update statistics table_name;
exec sp_recompile table_name;

drop index  idx_columns_a_b_c  on table_name;

update statistics table_name;
exec sp_recompile table_name;
0
 

Author Closing Comment

by:tesla764
ID: 34971846
Thanks, that worked.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question