Home > Database > Mysql Tutorial > body text

mysql分区部类

WBOY
Release: 2016-06-07 16:25:22
Original
1222 people have browsed it

mysql分区类型 分区类型 ? 1、RANGE分区 ? CREATE TABLE employees ( ? ? id INT NOT NULL, ? ? fname VARCHAR(30), ? ? lname VARCHAR(30), ? ? hired DATE NOT NULL DEFAULT '1970-01-01', ? ? separated DATE NOT NULL DEFAULT '9999-12-31', ? ? job_code

mysql分区类型

分区类型

?

1、RANGE分区

?

CREATE TABLE employees (

? ? id INT NOT NULL,

? ? fname VARCHAR(30),

? ? lname VARCHAR(30),

? ? hired DATE NOT NULL DEFAULT '1970-01-01',

? ? separated DATE NOT NULL DEFAULT '9999-12-31',

? ? job_code INT NOT NULL,

? ? store_id INT NOT NULL

)

PARTITION BY RANGE (store_id) (

? ? PARTITION p0 VALUES LESS THAN (6),

? ? PARTITION p1 VALUES LESS THAN (11),

? ? PARTITION p2 VALUES LESS THAN (16),

? ? PARTITION p3 VALUES LESS THAN (21)

);

?

2、LIST分区

?

CREATE TABLE employees (

? ? id INT NOT NULL,

? ? fname VARCHAR(30),

? ? lname VARCHAR(30),

? ? hired DATE NOT NULL DEFAULT '1970-01-01',

? ? separated DATE NOT NULL DEFAULT '9999-12-31',

? ? job_code INT,

? ? store_id INT

)

PARTITION BY LIST(store_id)

? ? PARTITION pNorth VALUES IN (3,5,6,9,17),

? ? PARTITION pEast VALUES IN (1,2,10,11,19,20),

? ? PARTITION pWest VALUES IN (4,12,13,14,18),

? ? PARTITION pCentral VALUES IN (7,8,15,16)

);

?

3、HASH分区

?

CREATE TABLE employees (

? ? id INT NOT NULL,

? ? fname VARCHAR(30),

? ? lname VARCHAR(30),

? ? hired DATE NOT NULL DEFAULT '1970-01-01',

? ? separated DATE NOT NULL DEFAULT '9999-12-31',

? ? job_code INT,

? ? store_id INT

)

PARTITION BY HASH(YEAR(hired))

PARTITIONS 4;

?

4、KEY分区

?

5、子分区

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template