Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ MySQL composite partition     - hadoop 2.7.1 High Availability Setup Deployment (Server)

- MongoDB polymerization being given (Database)

- To setup a ftp server under Linux (Server)

- Ubuntu How to install Pacman (Linux)

- Let Markdown code syntax highlighting and support Django1.6 (Linux)

- LogStash log analysis display system (Linux)

- Gentoo: startx appeared Failed to load module Problem Solving (Linux)

- CoreCLR compiled in Linux CentOS (Linux)

- Linux tmux tcpdump summary (Linux)

- MySQL display operation control tips (Database)

- Linux user login and IP restrictions (Linux)

- HAProxy performance under high concurrency (Server)

- Mhddfs: multiple smaller partitions into one large virtual storage (Linux)

- HttpClient Tutorial (Programming)

- ORA-00600 error solve one case (Database)

- How to use Android Studio to play more package names APK (Programming)

- Ubuntu and Archlinux install Notepadqq 0.50.2 (Linux)

- How SSHfs mount a remote file system on Linux (Linux)

- Linux Getting Started Tutorial: Ubuntu laptop screen brightness adjustment (Linux)

- Java enum use (Programming)

 
         
  MySQL composite partition
     
  Add Date : 2017-01-08      
         
         
         
  MySQL supports composite partitions Oracle is far from rich. In MySQL 5.6 release, only supports RANGE and LIST sub-district, sub-district and only type of HASH and KEY.

for example:

CREATE TABLE ts (id INT, purchased DATE)
    PARTITION BY RANGE (YEAR (purchased))
    SUBPARTITION BY HASH (TO_DAYS (purchased))
    SUBPARTITIONS 2 (
        PARTITION p0 VALUES LESS THAN (1990),
        PARTITION p1 VALUES LESS THAN (2000),
        PARTITION p2 VALUES LESS THAN MAXVALUE
    );
Create the above statement, the outermost layer is RANGE partition, divided into three zones, which are HASH sub-partition, divided into two zones, so that the table was divided into 3 * 2 = 6 partitions.

Of course, you can also use SUBPARTITION statement to define the display sub-partition.

CREATE TABLE ts (id INT, purchased DATE)
    PARTITION BY RANGE (YEAR (purchased))
    SUBPARTITION BY HASH (TO_DAYS (purchased)) (
        PARTITION p0 VALUES LESS THAN (1990) (
            SUBPARTITION s0,
            SUBPARTITION s1
        ),
        PARTITION p1 VALUES LESS THAN (2000) (
            SUBPARTITION s2,
            SUBPARTITION s3
        ),
        PARTITION p2 VALUES LESS THAN MAXVALUE (
            SUBPARTITION s4,
            SUBPARTITION s5
        )
    );
note:

1> If you use SUBPARTITION statement in the partition, each partition must be defined, and the number of neutrons each partition partition must be consistent. For example, the following two usage will be given:

CREATE TABLE ts (id INT, purchased DATE)
    PARTITION BY RANGE (YEAR (purchased))
    SUBPARTITION BY HASH (TO_DAYS (purchased)) (
        PARTITION p0 VALUES LESS THAN (1990) (
            SUBPARTITION s0,
            SUBPARTITION s1
        ),
        PARTITION p1 VALUES LESS THAN (2000) (
            SUBPARTITION s2
        ),
        PARTITION p2 VALUES LESS THAN MAXVALUE (
            SUBPARTITION s3,
            SUBPARTITION s4
        )
    );
 
 
CREATE TABLE ts (id INT, purchased DATE)
    PARTITION BY RANGE (YEAR (purchased))
    SUBPARTITION BY HASH (TO_DAYS (purchased)) (
        PARTITION p0 VALUES LESS THAN (1990) (
            SUBPARTITION s0,
            SUBPARTITION s1
        ),
        PARTITION p1 VALUES LESS THAN (2000),
        PARTITION p2 VALUES LESS THAN MAXVALUE (
            SUBPARTITION s2,
            SUBPARTITION s3
        )
    );
2> SUBPARTITION statement, you can specify the physical location of the partition. for example:

CREATE TABLE ts (id INT, purchased DATE)
    PARTITION BY RANGE (YEAR (purchased))
    SUBPARTITION BY HASH (TO_DAYS (purchased)) (
        PARTITION p0 VALUES LESS THAN (1990) (
            SUBPARTITION s0a
                DATA DIRECTORY = '/ disk0'
                INDEX DIRECTORY = '/ disk1',
            SUBPARTITION s0b
                DATA DIRECTORY = '/ disk2'
                INDEX DIRECTORY = '/ disk3'
        ),
        PARTITION p1 VALUES LESS THAN (2000) (
            SUBPARTITION s1a
                DATA DIRECTORY = '/ disk4 / data'
                INDEX DIRECTORY = '/ disk4 / idx',
            SUBPARTITION s1b
                DATA DIRECTORY = '/ disk5 / data'
                INDEX DIRECTORY = '/ disk5 / idx'
        ),
        PARTITION p2 VALUES LESS THAN MAXVALUE (
            SUBPARTITION s2a,
            SUBPARTITION s2b
        )
    );
The above statement is created, will be distributed to different partitions under different physical paths, it will undoubtedly greatly dispersed IO, which is still quite attractive.

Unfortunately, the unit testing process, reported "ERROR 1030 (HY000): Got error -1 from storage engine" error, the specific reasons not yet clear, suspected of MySQL bug.

reference:

http://dev.mysql.com/doc/refman/5.6/en/partitioning-subpartitions.html

http://dev.mysql.com/doc/refman/5.6/en/tablespace-placing.html
     
         
         
         
  More:      
 
- Varnish achieve page jump (Server)
- JavaScript closures and the scope chain (Programming)
- Terminal multiplexing tool tmux use (Linux)
- ls command: 15 Level Linux interview question (Linux)
- Linux basic articles of the boot process (Linux)
- Installation of JDK and Tomcat under Linux (CentOS) (Linux)
- Sublime Text 3 best features, plug-ins and settings (Linux)
- CentOS yum configuration under local sources (Linux)
- Getting Started with Linux system to learn: how to check in a package is installed on Ubuntu (Linux)
- Win7 + Ubuntu Kylin + CentOS 6.5 installed three systems (Linux)
- Oracle for Oracle GoldenGate to achieve a one-way synchronization DDL operations (Database)
- Nine trick to let you speed up the old machine running Ubuntu Linux (Linux)
- error no.2013 lost connection Tom with SQLServer during query (Database)
- to install the deployment of LVS under CentOS 7.0 (Server)
- Linux System Getting Started Learning: the local time in between Perl and UNIX timestamp conversion (Linux)
- Linux modify the system time (Linux)
- Echo Command Examples (Linux)
- Error code: 2013 Lost connection to MySQL server during query (Database)
- Wine 1.7 is installed on a system based on RedHat or Debian (Linux)
- Linux file system data file deletion problem space is not freed (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.