Atitit. attilax Summary of common partition APIs
1. api source and oracle and mysql 1.1. partition definition partition by range (uid) use the values less than operator to define 1.1.1. mysqlpartition 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 = "/d Ata00/", 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 set partition by range (uid) (partition p0 values less than (10000) data directory = "/data00/" index directory = "/data00/", partition p1 valuelless than (20000) data directory = "/data00/" index directory = "/data00/", partit Ion 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 hash 1.2.1. oracle syntax hash partition: applies a hash function on one or more columns, and rows are placed in a partition according to 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 (). 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', 'beijinging '), partition part2 values ('shanghai', 'nanjing'), partition part3 values (default); 1.4. partition modification and merging 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 partition how create table name view create partition table Uapi listPatition 1.6.1. partition management oracle partitions can be performed in the same way as tables Add, delete, modify, and query. 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 partition: alter table student merge partitions p3, p4 into partition p6.