Answered by:
indexes and partitions:Creating an index on a specific partition

Question
-
Hi Evryone
I have just partitioned several tables and now i would like drop and create indexes per partition.So far i discovered that I can rebuild an existing index on a specific partition using :
ALTER INDEX IX_COL1 ON dbo.PartTable REBUILD Partition = 4; go
Now I would like to know the code for dropping an index on a specific partition as well as the code for creating an index on a specific partition.
best regards
Globalwarming
newbieWednesday, May 19, 2010 1:11 PM
Answers
-
You can align the indexes to the table or you can partition them independently (unaligned), but you can not have independent indexes per partition.
Special Guidelines for Partitioned Indexes
AMB
- Proposed as answer by Xiao-Min Tan – MSFT Friday, May 21, 2010 7:15 AM
- Marked as answer by Xiao-Min Tan – MSFT Thursday, May 27, 2010 9:30 AM
Wednesday, May 19, 2010 1:26 PM -
Rebuilding per partition allows you to remove fragmentation from just a subset of the index, or to move the subsection to a new filegroup, but the index belongs to the whole table. You cannot have an index on only part of a table (i.e. one partition).
HTH, Kalen Delaney www.SQLServerInternals.com- Proposed as answer by Xiao-Min Tan – MSFT Friday, May 21, 2010 7:14 AM
- Marked as answer by Xiao-Min Tan – MSFT Thursday, May 27, 2010 9:30 AM
Wednesday, May 19, 2010 3:37 PM
All replies
-
You can align the indexes to the table or you can partition them independently (unaligned), but you can not have independent indexes per partition.
Special Guidelines for Partitioned Indexes
AMB
- Proposed as answer by Xiao-Min Tan – MSFT Friday, May 21, 2010 7:15 AM
- Marked as answer by Xiao-Min Tan – MSFT Thursday, May 27, 2010 9:30 AM
Wednesday, May 19, 2010 1:26 PM -
you can create or drop partition index see the below code.
CREATE NONCLUSTERED INDEX IX_orders_aligned
50.
ON dbo.orders(order_id)
51.
ON test_monthlyDateRange_ps(orderDate);drop index index_name
- Proposed as answer by sekhara shiris chinta Wednesday, May 19, 2010 1:28 PM
Wednesday, May 19, 2010 1:27 PM -
Hi Evryone
I have just partitioned several tables and now i would like drop and create indexes per partition.So far i discovered that I can rebuild an existing index on a specific partition using :
ALTER INDEX IX_COL1 ON dbo.PartTable REBUILD Partition = 4; go
Now I would like to know the code for dropping an index on a specific partition as well as the code for creating an index on a specific partition.
best regards
Globalwarming
newbie
Mohd Sufian www.sqlship.wordpress.com Please mark the post as Answered if it helped.Wednesday, May 19, 2010 1:32 PM -
Mohammad
Why does sql allow me to rebuild in index on a specific partition?
newbieWednesday, May 19, 2010 2:33 PM -
Rebuilding per partition allows you to remove fragmentation from just a subset of the index, or to move the subsection to a new filegroup, but the index belongs to the whole table. You cannot have an index on only part of a table (i.e. one partition).
HTH, Kalen Delaney www.SQLServerInternals.com- Proposed as answer by Xiao-Min Tan – MSFT Friday, May 21, 2010 7:14 AM
- Marked as answer by Xiao-Min Tan – MSFT Thursday, May 27, 2010 9:30 AM
Wednesday, May 19, 2010 3:37 PM