Solved

Converting database from MyISAM to InnoDB

Posted on 2014-01-08
6
394 Views
Last Modified: 2014-01-14
Hello

I am about to convert a database from MyISAM to InnoDB and I was advised by someone that there might be 'structural issues' to resolve first. However that was all they said! Do you know what kind to structural issues could prevent a database from being converted from MyISAM to InnoDB. I am aware that InnDB doesn't support fulltext searches before 5.6 so fulltext fields could be a 'structural' issue in one sense, but I am presuming any schema can be converted from MyISAM to InnoDB.

Many thanks
0
Comment
Question by:andieje
  • 3
  • 2
6 Comments
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 250 total points
ID: 39765704
See the following http://dev.mysql.com/doc/refman/5.6/en/storage-engines.html, specifically the "Storage Engine Features Summary" table.  You will notice the storage limit, which may not be of consequence with data below 64TB; however, I think it highlights the optimal usage of each engine.  INNODB is better for transactional consistency/reliability while MyISAM is good for data warehousing (i.e., long-term storage and read-only systems).  With respect to storage, MyISAM tables are in three files, but INNODB lumps entire table into one and even entire database.  Therefore, it is important to understand this with the physical size limitations.

You will have to see if the other differences affect you.  For example, do you use geo-spatial data types in indexing?  INNODB does not support this whereas MyISAM does.  Little things like this can creep up, so the recommendation probably is to familiarize yourself with the strengths and weaknesses of both; therefore, I included reference links to both engines below.

In addition, review the limitations of INNODB:
http://dev.mysql.com/doc/refman/5.6/en/innodb-restrictions.html

Respectfully yours,

Kevin

MyISAM: http://dev.mysql.com/doc/refman/5.6/en/myisam-storage-engine.html
INNODB: http://dev.mysql.com/doc/refman/5.6/en/innodb-default-se.html
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 39765938
If I thought I needed to move from MyISAM to InnoDB, I would create a new InnoDB table and copy the data over from the MyISAM table to the InnoDB table.
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 39765978
I agree with Dave.  It also will allow you to resolve the "structural" issues as you are designing the new tables.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:andieje
ID: 39766302
Hi - Thanks for your answer.

 Can I ask why you would create new tables rather than simply use an alter statement to change the databsae engine?

In terms of creating new tables, Can i clarify this is what you mean:

1. create a new table with innodb engine
2. export data only from existing table into file or whatever
3. Import this data into the new table

What commands are best to use to do this? Is this the right command to export the data and create insert statements

mysqldump --skip-triggers --compact --no-create-info
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39766328
Creating a new table that uses InnoDB and copying is so that you won't suffer any data loss if the conversion goes wrong.  I believe that you don't even have to export the data if the table is in the same database.  Read the info on this page:  http://dev.mysql.com/doc/refman/5.6/en/ansi-diff-select-into-table.html   It looks like you can do the whole operation in one line of SQL.  If you have created the new table, you case use:

INSERT INTO `table2` SELECT * FROM `table1`;
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 39766331
Creating a new table protects you from conversion corrupting data.  It avoids dealing with issues of conversion in the original table by allowing you the opportunity to redesign your intended schema in the new engine.  Because the purposes and features of the engine are different, it could alter the design.  Therefore, it is like migrating from one database to another.  You can use tools to automate the migration, but often the headache of resolving the issues caused by the automation are worse than the tedious nature of recreating system from scratch and importing data if that makes sense.

EDIT: Just saw Dave's post.  Ditto.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question