mysql数据库自动分区 [英] mysql database automatic partitioning

查看:261
本文介绍了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 don't want to need to manually update the database.

当我最初创建数据库时,我有数据在11月09,12月09,1月10日,等。现在,当二月开始,我想一个2月10分区自动创建。这是可能的吗?

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

推荐答案

有几个解决方案,如果你想要一个完整的解决方案, https://web.archive.org/web/20121028114942/http://kickingtyres.com/words/mysql/mysql-partition-management/ =nofollow noreferrer> post on on kickingtyres 。它是一个存储过程处理分区分析和创建(与一些日志!)的基本组合。

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

所有你需要做的是调整到你的分区类型示例使用bigint分区),并计划使用MySQL事件计划程序运行过程。

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.

这篇关于mysql数据库自动分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆