Atitit. attilax Summary of common partition APIs, atititattilax
Atitit. attilax Summary of common partition APIs
1. Api source and oracle and mysql1
1.1. partition definition partition by range (uid) use the values less than operator to set 1
1.1.1. mysql1
1.1.2. Oracle partition definition partition by range (uid) use the values less than operator to set 2
1.2. The partition is based on hash2
1.2.1. Oracle syntax 2
1.3. list partition: partition by list (). 3
1.4. Partition modification and merging 3
1.5. Del parition3
1.6. View partition how create table name 4
1.6.1. partition management oracle4
2. Refer4
1. Api source and oracle and mysql
1.1. partition definition partition by range (uid)
Use the values less than operator to determine
Author: old wow's paw Attilax iron, EMAIL: 1466519819@qq.com
Reprinted please indicate Source: http://www.cnblogs.com/attilax/
1.1.1. mysql
Partition by range (uid)
(Partition p0 values less than (10000) data directory = "/data00/" index directory = "/data00 /",
Partition p1 values less than (20000) data directory = "/data00/" index directory = "/data00 /",
Partition p2 values less than (30000) data directory = "/data00/" index directory = "/data00 /",
Partition p3 values less than maxvalue data directory = "/data00/" index directory = "/data00 /"
);
1.1.2. Oracle partition definition partition by range (uid)
Use the values less than operator to determine
Partition by range (uid)
(Partition p0 values less than (10000) data directory = "/data00/" index directory = "/data00 /",
Partition p1 values less than (20000) data directory = "/data00/" index directory = "/data00 /",
Partition p2 values less than (30000) data directory = "/data00/" index directory = "/data00 /",
Partition p3 values less than maxvalue data directory = "/data00/" index directory = "/data00 /"
);
1.2. partitions follow the hash1.2.1. Oracle syntax
Hash partition: a hash function is used on one or more columns. rows are placed in a partition based on the hash value. This method is applicable to situations where you do not know how much data exists within a specified range, and where range partitions are used, the data volume varies greatly between different regions, and it is difficult to manually intervene in the number balancing of intervals. Syntax: partition by hash (). For example:
Create table department (
Deptnoid int primary key,
Deptname varchar (20)
)
Partition by hash (Deptnoid )(
Partition p1,
Partition p2
)
1.3. list partition: partition by list ().
Specify a discrete value set to determine the data that should be stored together. For example, you can specify that the rows in the STATUS column values ('A', 'M', 'z') are placed in partition 1, and the STATUS values ('D', p ', the rows in 'q') are placed in partition 2, and so on. The difference between list partitions and range partitions is that list partitions are partitioned according to a series of discrete values in advance. When new data is inserted into the table, the corresponding partition is found based on the partition key value. There is only one partition column in the list partition. Of course, the corresponding value of a single partition can be multiple. When partitioning, you must determine the values that may exist in the partition column. Once the inserted column value is not within the partition range, insertion/update will fail. Therefore, we recommend that you use list partitioning, create a default partition to store records that are not within the specified range, similar to the maxvalue partition in the range partition. Syntax: partition by list (). For example:
Create table ListTable (
Id int primary key,
Area varchar (10)
)
Partition by list (area)
(
Partition part1 values ('guangdong', 'beijing '),
Partition part2 values ('shanghai', 'nanjing '),
Partition part3 values (default)
);
1.4. Modify and merge partitions
The following is an example of dividing p0 partitions into 2 partitions s0 and s1:
1.5. Del parition
Alter table titles drop partition p01;
1.6. view the partition's how create table name
See create partition table
Uapi listPatition
1.6.1. partition management oracle
Partitions can be added, deleted, modified, and queried like tables. The SQL statement is as follows.
Add partition: alter table xxx add partition p5 values less than (100 ). Note that for partitions with range values such as list and range, the value of the added partition must be greater than the maximum value in the current partition. Otherwise, an error is returned. The hash partition does not have this restriction.
Delete partition: alter table student drop partition p4.
Merge partitions: alter table student merge partitions p3, p4 into partition p6.
2. Refer
Atitit. database partition design attilax Summary
Data library learning partition technology _doraemonls_xinlang blog .htm