Composite partitions (range-hash partition, range-list partition)

Source: Internet
Author: User

First range-hash partition. Let's say that the list partition does not support multiple columns, but the range and hash partitions support multiple columns.

Code as follows: SQL codeCreateTableGraderecord (Sno varchar2), sname varchar2 (a), dormitory varchar2 (3), Gradeint) partition byRange (grade) Subpartition byHash (sno,sname) (partition P1ValuesLess than (subpartition sp1,subpartition SP2), partition P2ValuesLess Than (MaxValue) (subpartition sp3,subpartition SP4));

The range is divided into grade, then the SNO and sname are partitioned, and the hash partitioning tends to be "average" when the data volume is large.

Inserting data: SQL codeInsert intoGraderecordValues(' 511601 ', ' Qui-gon ', ' 229 ', 92);Insert intoGraderecordValues(' 511602 ', ' Kay ', ' 229 ', 62);Insert intoGraderecordValues(' 511603 ', ' East ', ' 229 ', 26);Insert intoGraderecordValues(' 511604 ', ' light ', ' 228 ', 77);Insert intoGraderecordValues(' 511605 ', ' respect ', ' 228 ', 47);Insert intoGraderecord (Sno,sname,dormitory)Values(' 511606 ', ' PK ', ' 228 ');Insert intoGraderecordValues(' 511607 ', ' Ming ', ' 240 ', 90);Insert intoGraderecordValues(' 511608 ', ' nan ', ' 240 ', 100);Insert intoGraderecordValues(' 511609 ', ' Tao ', ' 240 ', 67);Insert intoGraderecordValues(' 511610 ', ' bo ', ' 240 ', 75);Insert intoGraderecordValues(' 511611 ', ' 铮 ', ' 240 ', 60);Insert intoGraderecordValues(' 511612 ', ' Beaver ', ' 244 ', 72);Insert intoGraderecordValues(' 511613 ', ' Jay ', ' 244 ', 88);Insert intoGraderecordValues(' 511614 ', ' wilt ', ' 244 ', 19);Insert intoGraderecordValues(' 511615 ', ' rustic ', ' 244 ', 65);Insert intoGraderecordValues(' 511616 ', ' Dan ', ' 244 ', 59);Insert intoGraderecordValues(' 511617 ', ' Jin ', ' 244 ', 95);

  queries are as follows: SQL code     Select  *  from  graderecord  partition (p1);   select  *  from  graderecord  partition (p2);   select  *  from  graderecord  subpartition (SP1);   select  *  from  graderecord  subpartition (SP2);  

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.