Solved

Converting database from MyISAM to InnoDB

Posted on 2014-01-08
6
393 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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