Friday, February 24, 2012

creating a clustered index - after the fact

Hello,
I have a few tables that I need to add clustered indexes to. However,
most of the table already have existing non-clustered indexes on them.
I understand that adding a clustered index after the other indexes is
not a good idea - but is this mostly a index creation performance issue
(in that the other indexes need to get rebuilt)? Or is there more to
the issue than this?
I can do the create after hours, so performance is not an issue. But I
am wondering should I just drop all the indexes on the tables, and
recreate them from scratch, in proper order?
Thankstootsuite,
It is a performance issue. For each table follow these steps in order:
1. drop all of the non-clustered indexes
2. drop the clustered index
3. create the new clustered index
4. create the new non-clustered indexes
If you drop the clustered index before the non-clustered indexes, the
non-clustered indexes are automatically re-indexed. When the new clustered
index is added the non-clustered indexes are reindexed again.
-- Bill
<tootsuite@.gmail.com> wrote in message
news:1169055466.451768.125760@.s34g2000cwa.googlegroups.com...
> Hello,
> I have a few tables that I need to add clustered indexes to. However,
> most of the table already have existing non-clustered indexes on them.
> I understand that adding a clustered index after the other indexes is
> not a good idea - but is this mostly a index creation performance issue
> (in that the other indexes need to get rebuilt)? Or is there more to
> the issue than this?
> I can do the create after hours, so performance is not an issue. But I
> am wondering should I just drop all the indexes on the tables, and
> recreate them from scratch, in proper order?
> Thanks
>|||thanks for the info
AlterEgo wrote:
> tootsuite,
> It is a performance issue. For each table follow these steps in order:
> 1. drop all of the non-clustered indexes
> 2. drop the clustered index
> 3. create the new clustered index
> 4. create the new non-clustered indexes
> If you drop the clustered index before the non-clustered indexes, the
> non-clustered indexes are automatically re-indexed. When the new clustered
> index is added the non-clustered indexes are reindexed again.
> -- Bill
> <tootsuite@.gmail.com> wrote in message
> news:1169055466.451768.125760@.s34g2000cwa.googlegroups.com...
> > Hello,
> >
> > I have a few tables that I need to add clustered indexes to. However,
> > most of the table already have existing non-clustered indexes on them.
> > I understand that adding a clustered index after the other indexes is
> > not a good idea - but is this mostly a index creation performance issue
> > (in that the other indexes need to get rebuilt)? Or is there more to
> > the issue than this?
> >
> > I can do the create after hours, so performance is not an issue. But I
> > am wondering should I just drop all the indexes on the tables, and
> > recreate them from scratch, in proper order?
> >
> > Thanks
> >

No comments:

Post a Comment