Oracle-table partitioning

Source: Internet
Author: User

Common oracle table partition usage:

1. table partitioning type:

A) range Partition

B) hash Partition

C) List Partition

D) composite partition includes range-Hash partition and list-Hash partition.

2. table partitioning syntax: syntax

 

A) range partition:

Create Table sales_range

(Salesman_id number (5 ),

Salesman_name varchar2 (30 ),

Sales_mount number (10 ),

Sales_date date)

Compress

Partition by range (sales_date)

(

Partition sales_Jan_2000 values less than (to_date ('2014/1/123', 'Mm/DD/yyyy ')),

Partition sales_Feb_2000 values less than (to_date ('2014/1/123', 'Mm/DD/yyyy ')),

Partition sales_others values less than (MAXVALUE)

);

Note: 1) The maxvalue here is greater than or equal to to_date ('2014/1/2 ', 'Mm/DD/yyyy;

2) You can use user_tab_partitions or dba_tab_partitions to view related table partitions. However, some data needs to be updated by calling dbms_stats.gather_schema_stats, such as num_rows.

B) hash partition

Create table sales_hash

(Salesman_id number (5 ),

Salesman_name varchar2 (30 ),

Sales_mount number (10 ),

Sales_date date)

Partition by hash (sales_date)

Partitions 4;

Note: 1) the partitions value must be the N power of 2.

2) In user_tab_partitions or dba_tab_partition, high_value is displayed as null. The display value of range partition is different from that of range partition.

C) list partition

Create table sales_list

(Salesman_id number (5 ),

Salesman_name varchar2 (30 ),

Sales_mount number (10 ),

Sales_state varchar2 (20 ),

Sales_date date)

Partition by list (sales_state)

(Partition sales_west values ('califonie', 'hawaii '),

Partition sales_east values ('newyork ', 'florida ')

);

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.