Today we are announcing SqlPartitioner, a new ruby gem for managing partitioned tables in MySQL.
If you have a table that accumulates a lot of timestamped data, you probably need to regularly delete old records to free up space. But naively deleting rows can take a lot of time, and burden the database. A better alternative is to partition the table, and then old partitions can be dropped with one quick operation. Partitioning can also improve query performance. Learn more about Partitioning in the MySQL Reference Manual.
After writing code to help manage partitions, we decided to move the code to a generic gem so it could be used with any MySQL table. SqlPartitioner can give you a nice programming interface for initializing partitioning, adding new partitions, and dropping old partitions.
If you are considering partitioning a table, and want to create a rake task for adding and removing partitions, the SqlPartitioner gem can make it simple to implement.
Check it out on Github. Pull requests are welcome.