HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to do Partition for MySQL 100GB table in zero downtime?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
partitiondowntime100gbmysqlforhowzerotable

Problem

I have a Innodb engine table with 100GB,I have a planned to do partition the table.Can anyone tell me how to do it in zero downtime?

In 100GB table the records are increasing for each and every seconds.How can I do partition with out affecting the incoming records?

Using Percona-Mysql 5.5.30.Innodb-file-per-table was enabled.

Please tell me the steps.

Solution

You may use one of the online-alter-table tools: these are specialized scripts which simulate an ALTER TABLE operation, using TRIGGERs and shadow tables, and which allow for non-interruptive process. Thus, they will copy your table in small chunks into a shadow table even while you are modifying (inserting, deleting, updating) your table, synching the two.

They end with a very brief (up to a few seconds, typically sub second) lock, where your original table is thrown away and the "shadow" table kicks in to replace it.

Two such tools are:

  • oak-online-alter-table, as part of the openark-kit (disclosure: I'm author of this tool). Been around since 2009 and the first of its kind.



  • pt-online-schema-change, as part of the percona-toolkit; later arrival but more sophisticated and more tested.

Context

StackExchange Database Administrators Q#49802, answer score: 4

Revisions (0)

No revisions yet.