PHP
  Home arrow PHP arrow Page 7 - Changing Table Structure in phpMyAdmin
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Changing Table Structure in phpMyAdmin
By: Marc Delisle
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 16
    2004-09-28


    Table of Contents:
  • Changing Table Structure in phpMyAdmin
  • Editing Field Attributes
  • BLOB (Binary Large Object)
  • ENUM and SET
  • Index Management
  • Multi-Field Indexes and Index Editing
  • Table Optimization: EXPLAIN a Query

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Changing Table Structure in phpMyAdmin - Table Optimization: EXPLAIN a Query
    ( Page 7 of 7 )

    In this section, we want to get some information about the index that MySQL uses for a specific query, and the performance impact of not having defined an index.

    Let's assume we want to use the following query:

    SELECT *
    FROM `books`
    WHERE author_id = 2 AND language = 'es'

    We want to know which books written by author 2 are in the es language, our code for Spanish.

    To enter this query, we use the SQL link from the database or the table menu, or the SQL query window. We enter this query in the query box and click Go. Whether the query finds any results is not important right now.

    phpMyAdmin

    Let's look at the header: SQL-query: [Edit] [Explain SQL] [Create PHP Code]

    We will now use the [Explain SQL] link to get information about which index (if any) has been used for this query:

    phpMyAdmin

    We can see that the EXPLAIN command has been passed to MySQL, telling us that the possible_keys used is author_language. Thus, we know that this index will be used for this type of query. If this index did not exist, the result would have been quite different:

    phpMyAdmin

    Here, the possible_keys (NULL) and the type (ALL) mean that no index would be used, and that all rows would need to be examined to find the desired data. Depending on the total number of rows, this could have a serious impact on the performance. We can ascertain the exact impact by examining the query timing that phpMyAdmin displays on each results page and comparing with or without the index:

    phpMyAdmin

    However, the difference in time can be minimal if we only have limited test data compared to a real table in production.

    Summary

    In this chapter we covered:

    • How to add fields, including special field types like TEXT, BLOB, ENUM, and SET
    • How to upload binary data into a BLOB field
    • How to manage indexes (multi-field and full-text)
    • How to get feedback from MySQL about which indexes are used in a specific query

    phpMyAdminThis 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.

    Buy this book now.



     
     
    >>> More PHP Articles          >>> More By Marc Delisle
     

       

    PHP ARTICLES

    - Adding Ordering and Grouping Clauses to the ...
    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek