Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql changing table engine MyISAM to InnoDB

On my site I have a visitor's table with 10 million rows.
Every request to the site inserts row to the table, in case the table is locked (usually in optimize query) visitors can't get into the site
The table engine is MyISAM and I want to change it to InnoDB
I have few questions:

  • How can I change the table engine without stoping my site from working
  • There is a way to optimize InnoDB table without locking it
like image 718
Idob Avatar asked Feb 03 '14 12:02

Idob


People also ask

How do I change MySQL table to InnoDB?

Access phpMyAdmin and select your database. Then click on SQL, place the following query and click on Go: ALTER TABLE my_table ENGINE = InnoDB; If the query is executed properly, the database engine of the table will be changed to InnoDB.

Should I use InnoDB or MyISAM?

The performance of InnoDB for large volumes of data is better as compared to MyISAM. MyISAM doesn't support transactional properties and is faster to read. As compared to InnoDB, the performance for a high volume of data is less.


1 Answers

The easiest way is

ALTER TABLE table_name ENGINE = InnoDB;

If you use InnoDB engine you should not worry about locking tables, because this engine locks data by rows.

like image 167
oleksii.svarychevskyi Avatar answered Sep 30 '22 15:09

oleksii.svarychevskyi