简体   繁体   中英

Will making a table innodb and partitioning improve performance in mysql?

I have a Myisam table with composite unique key of 2 columns and 90 million data. Now we are facing memory and load issues and after going through the web I am planning to include partitioning and changing this table to Innodb for better performance. But I have following concerns:

  1. Changing to innodb will have a huge downtime, Is it possible to minimize the downtime?

  2. Most of the select query are on a particular column of the key on which I am planning to have the hash partitioning, how much it will effect the query on another key column?

Will these changes improve the performance to the extent mentioned theoretically? Is there any better solution for such cases. Any suggestion or experience can be helpful.

My queries are simple like

Select * from Table where Col1= "Value"
Select * from Table where Col1="Value" and Col2 IN (V1,V2,V3)

Inserts are very frequently.

InnoDB will probably help some. Conversion to InnoDB comes with some issues, as I state in My conversion blog .

Partitioning, per se, buys no performance gain. My partitioning blog lists 4 cases where you can, with design changes, gain performance.

Regardless of the Engine, your two queries will both benefit from

INDEX(col1, col2)

No form of partitioning will help. HASH partitioning is especially useless.

Conversion to InnoDB will take a lot of downtime, unless pt-online-schema-change will work for your case. Research it.

Also read my answers and comments on Can i set up Mysql to auto-partition? for more specifics.

It may be that adding that index is the main performance gain. But you have to do a lengthy ALTER to get it. MyISAM does not have ALGORITHM=INPLACE .

Innodb (about perfomance we are talking now) have sense only when there are alot of inserts and updates to your table, because of row-locking table. If the most queries on your table are SELECTs then MyIsam will be faster. Advice: put in my.cnf key_buffer_size equal to 25% of your free RAM.

If inserts on your database are very frequent, you will likely gain performance by switching to innodb, which won't lock down entire tables to insert, allowing other clients to select data concurrently.

Regarding question #1, if you are worried about downtime, I'd suggest you find a parallel dump/load solution for migrating your data to innodb. if you simply run an ALTER statement on your tables, this is a single threaded operation which will be much slower.

Regarding #2, you'd have to post a schema along with your partitioning strategy and the queries you are worried about.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM