开发者

MySQL Partitioning and Unix Timestamp

开发者 https://www.devze.com 2023-04-07 20:20 出处:网络
I\'ve just started reading on MySQL partitions, they kind of look too good to be true, please bear with me.

I've just started reading on MySQL partitions, they kind of look too good to be true, please bear with me.

I have a table which I would like to partition (which I hope would bring better performance). This is the case / question:

We have a column which stores Unix timestamp values, is it possible to partition the table in that way, that based on the unix timestamp the partitions are separated on a single 开发者_开发知识库date? Or do I have to use range based partitioning by defining the ranges before?

Cheers


You can do whatever you feel like, See: http://dev.mysql.com/doc/refman/5.5/en/partitioning-types.html

And example of partitioning by unix_timestamp would be:

ALTER TABLE table1 PARTITION BY KEY myINT11timestamp PARTITIONS 1000;
-- or
ALTER TABLE table1 PARTITION BY HASH (myINT11timestamp/1000) PARTITIONS 10;

Everything you wanted to know about partitions in MySQL 5.5: http://dev.mysql.com/tech-resources/articles/mysql_55_partitioning.html

0

精彩评论

暂无评论...
验证码 换一张
取 消