Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
MySQL Admin Cookbook LITE: Replication and Indexing

You're reading from  MySQL Admin Cookbook LITE: Replication and Indexing

Product type Book
Published in May 2011
Publisher
ISBN-13 9781849516143
Pages 104 pages
Edition 1st Edition
Languages

Removing indexes from tables

Once-useful indexes may become obsolete as requirements change with the evolving database. In this chapter, we will show you how to get rid of the IDX_author index created in the Adding indexes to tables recipe.

Getting ready

Connect to the database server with your administrative account.

How to do it...

  1. Change the default database to library:
    USE library;
    
  2. Drop the IDX_author index using the following command:
    ALTER TABLE books DROP INDEX IDX_author;
    

How it works...

Using the ALTER TABLE statement, we tell the database that we want to remove (DROP) the index named IDX_author from the books table.

There's more...

As with the creation of new indexes, you can drop multiple indexes at once using the ALTER TABLE statement by simply adding more DROP INDEX clauses, separated by comma. If you were to delete both indexes defined in Adding indexes to tables, you could use this statement:

ALTER TABLE books DROP INDEX IDX_author, DROP INDEX IDX_title;

See also

  • Adding indexes...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}