HomePHP Page 5 - Changing Table Structure in phpMyAdmin
Index Management - PHP
This chapter explores editing table definitions and using special column types. When developing Web applications (or any application), requirements often change because of new or modified needs. Developers must accommodate these changes through judicious table-structure editing. This is chapter six of Mastering phpMyAdmin for Effective MySQL Management by Marc Delisle (Packt Publishing, April 2004, ISBN 1904811035).
phpMyAdmin has a number of index management options, which we will cover in this section.
Single-Field Indexes
We have already seen how the Structure panel offers a quick way to create an index on a single field, thanks to some quick links like Primary, Index, and Unique. Under the field list, there is a section of the interface used to manage indexes:
This section has links to edit or delete every index. Here, the Field part lists only one field per index, and we can see that the whole field participates in the index.
We will now add an index on the title. However, we want to restrict the length of this index to reduce the space used by the on-disk index structure. The Create an index on 1 column option is appropriate, so we click Go. In the next screen, we specify the index details as shown in the following screen:
Here is how to fill this panel:
Index name: A name we invent
Index type: We can choose INDEX or UNIQUE
Field: We select the field that is used as the index, which is the title field
Size: We enter 30 instead of 100 (the complete length of the field) to save space
After saving this panel, we can confirm from the following screenshot that the index is created and does not cover the whole length of the title field:
This chapter is from Mastering phpMyAdmin for Effective MySQL Management by Marc Delisle (Packt Publishing, April 2004, ISBN 1904811035). Check it out at your favorite bookstore today.