Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Altering an Index

Unlike a table, it is not possible to use an ALTER command to change the columns contained in an index. To do this, you first have to drop the index and then re-create it. The DROP command will physically remove the index from the table; therefore, you should ensure that you know what the contents of the index are before you drop the index, if you want to re-create a similar index.

images Tip  One method that should allow you to re-create the index is storing all your database code in a source control system such as Visual SourceSafe.

Also re-creating an index can take a large amount of time, depending on the index, the columns, and the volume of data. It could take hours, so you have to take this into account and definitely complete a “dry run” on a development instance of an index build where there are hundreds of thousands or millions of rows involved. Don’t be caught out with unexpected rebuild times in a production environment.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint