


Detailed explanation of the difference between Mysql partition and Oracle 10 partitions
MySQL Commonly used partitions are: range, list, hash, key. Commonly used Oracle10g partitions are: range (range partition), list (list partition), hash (hash partition), range- hash (range-hash partition), range-list (list-composite partition). The following is a detailed introduction to the differences between Oracle10 partitions and Mysql partitions through this article. Let’s take a look at
The commonly used Oracle10g partitions are: range (range partition), list (list partition), hash (hash partition), range -hash (range—hash partition), range-list (list—composite partition).
Range partitioning: Range partitioning is a table partitioning method with a wide range of applications. It uses the range of column values as the partitioning condition, and stores records in the range partition where the column value is located.
If divided according to time, the data in January 2010 is placed in partition a, and the data in February is placed in partition b. When creating, you need to specify the based column and the range value of the partition.
When partitioning by time, if the range of some records cannot be predicted temporarily, you can create a maxvalue partition. All records that are not within the specified range will be stored in the partition where maxvalue is located. For example:
createtable pdba (id number, time date) partition by range (time) ( partitionp1 values less than (to_date('2010-10-1', 'yyyy-mm-dd')), partitionp2 values less than (to_date('2010-11-1', 'yyyy-mm-dd')), partitionp3 values less than (to_date('2010-12-1', 'yyyy-mm-dd')), partitionp4 values less than (maxvalue) )
Hash partition:
For those tables that cannot be effectively divided into ranges, hash partitioning can be used, which will still be helpful to improve performance. Hash partitioning will evenly distribute the data in the table to several partitions you specify. The partition where the column is located is automatically allocated based on the hash value of the partition column, so you have no control or knowledge about which record will be placed in which partition. , hash partitioning can also support multiple dependent columns. Such as:
createtable test ( transaction_idnumber primary key, item_idnumber(8) not null ) partitionby hash(transaction_id) ( partitionpart_01 tablespace tablespace01, partitionpart_02 tablespace tablespace02, partitionpart_03 tablespace tablespace03 );
Here, we specify the table space for each partition.
List partition:
List partition also needs to specify the value of the column. The partition value must be clearly specified. There can only be one partition column, and it cannot be like range or hash. Partitioning specifies multiple columns as partition dependent columns at the same time, but its corresponding value for a single partition can be multiple.
When partitioning, you must determine the possible values of the partition column. Once the inserted column value is not within the partition range, the insertion/update will fail. Therefore, it is usually recommended to 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.
When partitioning based on a certain field, such as city code, you can specify default and put all non-partitioning rule data into this default partition. For example:
createtable custaddr ( idvarchar2(15 byte) not null, areacodevarchar2(4 byte) ) partitionby list (areacode) (partition t_list025 values ('025'), partitiont_list372 values ('372') , partitiont_list510 values ('510'), partitionp_other values (default) )
Combined partitioning:
If a table is still large after being partitioned according to a certain column, or there are some other requirements, Partitions can also be subdivided by creating subpartitions within the partition, that is, combining partitions.
There are two types of combined partitions in 10g: range-hash and range-list. Pay attention to the order. The root partition can only be a range partition, and the sub-partition can be a hash partition or a list partition.
For example:
createtable test ( transaction_idnumber primary key, transaction_datedate ) partitionby range(transaction_date) subpartition by hash(transaction_id) subpartitions3 store in (tablespace01,tablespace02,tablespace03) ( partitionpart_01 values less than(to_date('2009-01-01','yyyy-mm-dd')), partitionpart_02 values less than(to_date('2010-01-01','yyyy-mm-dd')), partitionpart_03 values less than(maxvalue) ); createtable emp_sub_template (deptno number, empname varchar(32), grade number) partitionby range(deptno) subpartition by hash(empname) subpartitiontemplate (subpartitiona tablespace ts1, subpartitionb tablespace ts2, subpartitionc tablespace ts3, subpartitiond tablespace ts4 ) (partitionp1 values less than (1000), partitionp2 values less than (2000), partitionp3 values less than (maxvalue) ); createtable quarterly_regional_sales (deptnonumber, item_no varchar2(20), txn_datedate, txn_amount number, state varchar2(2)) tablespacets4 partitionby range (txn_date) subpartitionby list (state) (partitionq1_1999 values less than (to_date('1-apr-1999','dd-mon-yyyy')) (subpartitionq1_1999_northwest values ('or', 'wa'), subpartitionq1_1999_southwest values ('az', 'ut', 'nm'), subpartitionq1_1999_northeast values ('ny', 'vm', 'nj'), subpartitionq1_1999_southeast values ('fl', 'ga'), subpartitionq1_1999_northcentral values ('sd', 'wi'), subpartitionq1_1999_southcentral values ('ok', 'tx') ), partitionq2_1999 values less than ( to_date('1-jul-1999','dd-mon-yyyy')) (subpartitionq2_1999_northwest values ('or', 'wa'), subpartitionq2_1999_southwest values ('az', 'ut', 'nm'), subpartitionq2_1999_northeast values ('ny', 'vm', 'nj'), subpartitionq2_1999_southeast values ('fl', 'ga'), subpartitionq2_1999_northcentral values ('sd', 'wi'), subpartitionq2_1999_southcentral values ('ok', 'tx') ), partitionq3_1999 values less than (to_date('1-oct-1999','dd-mon-yyyy')) (subpartitionq3_1999_northwest values ('or', 'wa'), subpartitionq3_1999_southwest values ('az', 'ut', 'nm'), subpartitionq3_1999_northeast values ('ny', 'vm', 'nj'), subpartitionq3_1999_southeast values ('fl', 'ga'), subpartitionq3_1999_northcentral values ('sd', 'wi'), subpartitionq3_1999_southcentral values ('ok', 'tx') ), partitionq4_1999 values less than ( to_date('1-jan-2000','dd-mon-yyyy')) (subpartitionq4_1999_northwest values ('or', 'wa'), subpartitionq4_1999_southwest values ('az', 'ut', 'nm'), subpartitionq4_1999_northeast values ('ny', 'vm', 'nj'), subpartitionq4_1999_southeast values ('fl', 'ga'), subpartitionq4_1999_northcentral values ('sd', 'wi'), subpartitionq4_1999_southcentral values ('ok', 'tx') ) );
Commonly used MySQL partitions are: range, list, hash, key
RANGE partitioning (portioning): According to the range interval to which the column value belongs, the elements are divided into Groups are assigned to partitions.
LIST partitioning: Similar to partitioning by RANGE, the difference is that LIST partitioning is selected based on the column value matching a certain value in a discrete value set.
HASH partitioning: Partitioning selected based on the return value of a user-defined function that expression uses the columns of the rows to be inserted into the table value is calculated. This function can contain any expression that is valid in MySQL and produces a non-negative integer value.
KEY partitioning: Similar to HASH partitioning, the difference is that KEY partitioning only supports calculation of one or more columns, and the MySQL server provides its own hash function.
The above is the detailed content of Detailed explanation of the difference between Mysql partition and Oracle 10 partitions. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting

Building a Hadoop Distributed File System (HDFS) on a CentOS system requires multiple steps. This article provides a brief configuration guide. 1. Prepare to install JDK in the early stage: Install JavaDevelopmentKit (JDK) on all nodes, and the version must be compatible with Hadoop. The installation package can be downloaded from the Oracle official website. Environment variable configuration: Edit /etc/profile file, set Java and Hadoop environment variables, so that the system can find the installation path of JDK and Hadoop. 2. Security configuration: SSH password-free login to generate SSH key: Use the ssh-keygen command on each node

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.
