Académique Documents
Professionnel Documents
Culture Documents
Yasin Mohammed
Technology Consultant
yasin.mohammed@oracle.com
Nirmal Grewal
Technology Sales Representative
nirmal.grewal@oracle.com
Agenda
Partitioning in a nutshell
Getting optimal pruning
Partition exchange loading
Partitioning and unusable indexes
Efficient statistics management
Q&A
Large Table
Partition
Composite Partition
Difficult to Manage
Better Performance
Easier to Manage
Improve Performance
Transparent to applications
It is
Powerful functionality to logically partition objects into
smaller pieces
Only driven by business requirements
Partitioning for Performance, Manageability, and
Availability
It is not
Just a way to physically divide or clump - any large
data set into smaller buckets
Enabling pre-requirement to support a specific
hardware/software design
Hash mandatory for shared nothing systems
Enables parallelism
DB
DB
DB
DB
Agenda
Partitioning in a nutshell
Getting optimal pruning
Partition exchange loading
Partitioning and unusable indexes
Efficient statistics management
Q&A
Partition Pruning
Q: What was the total
sales for the weekend
of May 20 - 22 2008?
Sales Table
May 18th 2008
Select sum(sales_amount)
From SALES
to_date(05/20/2008,MM/DD/YYYY)
And
to_date(05/23/2008,MM/DD/YYYY);
Only the 3
relevant
partitions are
accessed
Partition Pruning
Static Pruning
Sample plan
Static Pruning
Sample plan
04-Jan
04-Feb
04-Mar
04-Apr
04-May
Time
04-Jun
Sales
SELECT sum(amount_sold)
FROM sales s, times t
WHERE t.time_id = s.time_id
AND
t.calendar_month_desc IN
(MAR-2004, APR-2004,
MAY-2004);
20
AND Pruning
Example:
Star transformation with pruning predicate on both the FACT
Dynamic pruning
table and a dimension
FROM sales s, times t
Static pruning
WHERE s.time_id = t.time_id ..
AND t.fiscal_year in (2000,1999)
AND s.time_id
between TO_DATE('01-JAN-1999','DD-MON-YYYY')
and TO_DATE('01-JAN-2000','DD-MON-YYYY')
21
AND Pruning
Sample plan
Agenda
Partitioning in a nutshell
Getting optimal pruning
Partition exchange loading
Partitioning and unusable indexes
Efficient statistics management
Q&A
3. Create indexes
Tmp_ sales
Table
Sales Table
Sales Table
5. Collect
stats
Sales
table now
has all the
data
Agenda
Partitioning in a nutshell
Getting optimal pruning
Partition exchange loading
Partitioning and unusable indexes
Efficient statistics management
Q&A
Unusable Indexes
Multi-Branch Execution
Sample plan
Agenda
Partitioning in a nutshell
Getting optimal pruning
Partition exchange loading
Partitioning and unusable indexes
Efficient statistics management
Q&A
Statistics Gathering
Use AUTO_SAMPLE_SIZE
The only setting that enables new efficient statistics collection
Hash based algorithm, scanning the whole table
Speed of sampling, accuracy of compute
Sysaux Tablespace
4. Gather partition
statistics for new
partition
Sysaux Tablespace
The command will collect statistics for partitions and update the global
statistics based on the partition level statistics and synopsis
Possible to set incremental to true for all tables
Only works for already existing tables
EXEC DBMS_STATS.SET_GLOBAL_PREFS('INCREMENTAL','TRUE');
Summary
Partitioning in a nutshell
Getting optimal pruning
Partition exchange loading
Partitioning and unusable indexes
Efficient statistics management
Demo (Performance & availability)
Partitioning Demonstration
Table: SALES_p1
Partitioning Scheme used:
Initially Partitioned into yearly, halve-yearly, and quarterly periods
Further Partitioned by country regions
Table: SALES_nop1
For comparison purposes, a similar non-partitioned table is created.
450000
400000
350000
300000
250000
200000
150000
100000
50000
0
Table: CUSTOMER_p1
Partitioning Scheme used:
Partitioned by country regions
Table: CUSTOMER_nop1
For comparison purposes, a similar table is created as non-partitioned.
300000
250000
200000
150000
100000
50000
0
Denmark
Poland
South Africa
China
United Kingdom
New Zealand
Saudi Arabia
COUNT(C.CUST_ID)
Australia
Canada
Singapore
Argentina
Italy
Japan
Turkey
Demonstration Infrastructure
Equipment
Areas highlighted in red show the resulting overhead of accessing normal table structures.
Areas highlighted in green reveal the overhead benefits of accessing partitions instead the whole table.
Note: Above graph details were generated by sar directives from a VMWare image installed on a notebook. The Demo will use an Amazon AMI.
Partitioned Table
Note: sales_nop2 data resides in example tablespace which in-turn references datafile example01.dbf.
Partitioned Table
Demo Summary
Performance improvement - Scenario 1
Up to 3 times faster than traditional methods of data retrieval.
Availability Enhancement - Scenario 2
Limits detrimental effects of data access failures.
In General
Improves system scalability and manageability.
Adds data-level of protection to any High Availability strategy.
Next Steps
Upcoming Webinars
More coming soon!!!
http://otn.oracle.com/database
Follow OracleDirect ANZ on Twitter at
http://www.twitter.com/OracleDirectANZ
Or our NEW!!! blog http://blogs.oracle.com/techtalk