mysql 自动分区,mysql数据库自动分区

I have a mysql database table that I want to partition by date, particularly by month & year. However, when new data is added for a new month, I dont want to need to manually update the database.

When I initially create my database, I have data in Nov 09, Dec 09, Jan 10, etc. Now when February starts, Id like a Feb 10 partition automatically created. Is this possible?

解决方案

There are a few solutions out there, if you want a total solution, check this post out on kickingtyres. Its a basic combination of a stored procedure handling the partition analysis and creation (with some logging!).

All you need to do is adjust it to your partition type (the example uses a bigint partition) and schedule the procedure to run with the MySQL Event Scheduler.

I have a mysql database table that I want to partition by date, particularly by month & year. However, when new data is added for a new month, I dont want to need to manually update the database. When I initially create my database, I have data in Nov 09, Dec 09, Jan 10, etc. Now when February starts, Id like a Feb 10 partition automatically created. Is this possible? 解决方案 There are a few solutions out there, if you want a total solution, check this post out on kickingtyres. Its a basic combination of a stored procedure handling the partition analysis and creation (with some logging!). All you need to do is adjust it to your partition type (the example uses a bigint partition) and schedule the procedure to run with the MySQL Event Scheduler.
经验分享 程序员 微信小程序 职场和发展