What are Table partitions?
• Table partitions are used to improve the performance of a retrieval/SELECT
query
• Index will work effectively only when data retrieved is lesser than 15% data
volume
• If retrieved data volume by a select query is more than 15% every time than
table partition will be the right choice
• Types of Table partition LIST, RANGE, HASH
RANGE - PARTITION
*******************
CREATE TABLE sales
(
sale_id number ,
product_ id number,
price number
)
PARTITIONS BY RANGE (sales_id) (
partition s1 values less than (10000) tablespace ts1,
partition s2 values less than (3000) tablespace ts2,
partition s3 values less than (MAXVALUE) tablespace ts3
);
LIST PARTITION
*******************
CERATE TABLE dept_region
(dept_id NUMBER NOT NULL,
dept_name VARCHAR2(20),
trans_value NUMBER (10,2)
state VARCHAR2(2)
)
PARTITIONS BY LIST(state)
(
partition EMEA VALUES ('AND','UAE','AFGH'),
partition APAC VALUES ('AUS','IND'),
partition LATAM VALUES ('JAMICA','MEXIO'),
partition unknow VALUES ('DEFAULT')
);
_________________________
What is partition pruning ?
***********************
In a SQL query if we have partitioned table and appropriate column is called in
WHERE clause then ORACLE
query optimizer decides which partitions will be ignored and which partitions will
be accessed and read.
This is called partition pruning. It is an essential performance feature for data
warehouses.