Someone told me to look into his website for quick optimization; I'm a programmer and i don't have much experience optimizing databases.
I have a php/MySQL site uses the MyISAM storage engine. It doesn't have any indexes on the columns.
I want to change the engine to innoDB and add indexes to the columns.
Some tables have a couple hundred thousand rows so it's not a very small database.
My question is mostly about the data that already is in the database. Do I need to do anything after these changes to make the already stored data aware of that ? or make them compatible with these changes ?
Best Answer
You came to right place. Let's look at an example.
Suppose you have the following MyISAM table:
You said you want to do two things:
For the above table, here is how to convert the table to InnoDB and add an index on names
Here is a way to make the table InnoDB, index it, and keep the original as MyISAM
CAVEAT
This answer is really an oversimplification of the conversion. There are still other aspects of setting up InnoDB (Here is a Pictorial Representation of InnoDB's Infrastructure). Here are a few of my past posts on such configuration due diligence:
Feb 12, 2011
: How do you tune MySQL for a heavy InnoDB workload?Feb 16, 2011
: How to safely change MySQL innodb variable 'innodb_log_file_size'?Mar 04, 2011
: Clarification on MySQL innodb_flush_method variableApr 14, 2011
: What are the main differences between InnoDB and MyISAM?Sep 12, 2011
: Possible to make MySQL use more than one core?Feb 22, 2012
: Ibdata usage and Recommendations?Apr 01, 2012
: Is innodb_file_per_table advisable?