Home >Database >Mysql Tutorial >使用partition建立RANGE类型按TO_DAYS划分的表分区

使用partition建立RANGE类型按TO_DAYS划分的表分区

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:55:421836browse

mysql中对数据表有RANGE,LIST,HASH,KEY四种类型的分区方式。下面为按照RANGE进行分区的方式: create table sales2 ( id NUMERIC,sale_date datetime not null)PARTITION by range(TO_DAYS(sale_date))( PARTITION sales20140301 values less than(TO_DAY

mysql中对数据表有RANGE,LIST,HASH,KEY四种类型的分区方式。下面为按照RANGE进行分区的方式:

create table sales2 ( id NUMERIC,sale_date datetime not null)
PARTITION by range(TO_DAYS(sale_date))
(
   PARTITION sales20140301 values less than(TO_DAYS('2014-03-01')),
   PARTITION sales20140401 values less than(TO_DAYS('2014-04-01'))
)
TO_DAYS('2014-03-01') 时间并不包括当前的时间,而是此前的日期。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn