Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Converting database from MyISAM to InnoDB

Posted on 2014-01-08
6
Medium Priority
?
402 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 1000 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 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 1000 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 60

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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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 84

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 60

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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

688 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