Detailed analysis: Oracle Table Partitioning (1)

Source: Internet
Author: User

In Oracle table partitions, a table can be divided into multiple small parts. This improves the query performance of Oracle table partitions, manages table data, and optimizes the performance of backup and recovery operations.

Oracle table partitions are divided into several types (range partitions, hash partitions, subpartitions, list partitions, and index partitions ).

Now let's create a [range partition]

 
 
  1. create table RangeTable(  
  2.  id int primary key,  
  3.  name varchar(20),  
  4.  grade int  
  5. )  
  6. partition by rang(grade)  
  7. (  
  8. partition part1 values less then(50) tablespace Part1_tb,  
  9. partition part2 values less then(MAXVALUE) tablespace Part2_tb  
  10. );  

If the grade value is less than 50, the record will be placed in the partition named part1, And the part1 partition will be stored in the Part1_tb tablespace.
Others are placed in part2. MAXVALUE is the keyword of Oracle to indicate the maximum value.

[Hash partition]

 
 
  1. create table HashTable(  
  2.  id int primary key,  
  3.  name varchar(20),  
  4.  grade int  
  5. )  

/* There are two methods: 1 is to specify the number of partitions and the tablespace used, 2 is to specify the partition named */

 
 
  1. Partition by hash (grade)
  2. Partitions 10 -- specify the number of partitions
  3. Store in (Part1_tb, Part2_tb, Part3_tb) -- if the number of specified partitions is greater than that of the tablespace, the partitions are allocated to the tablespace cyclically.
  4. /*------------------------------------*/
  5. Partition by rang (grade) -- this method specifies the partition named after
  6. (
  7. Partition part1 tablespace Part1_tb,
  8. Partition part2 tablespace Part2_tb
  9. );


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.