Solved

Converting database from MyISAM to InnoDB

Posted on 2014-01-08
6
385 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 82

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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 82

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now