www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.comwww.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com About Me Email:liu.maclean@gmail.com Blog:www.oracledatabase12g.com Oracle Certified Database Administrator Master 10g and 11g Over 6 years experience with Oracle DBA technology Over 7 years experience with Linux technology Member Independent Oracle Users Group Member All China Users Group Presents for advanced Oracle topics: RAC, DataGuard, Performance Tuning and Oracle Internal.
www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.comwww.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com Oracle Partitioning 分区特性 核心功能 性能增强 管理 Oracle8 Range partitioning Global range indexes “ Static” partition pruning Basic maintenance operations: add, drop, exchange Oracle8 i Hash and composite range-hash partitioning Partition-wise joins “ Dynamic” pruning Merge operation Oracle9 i List partitioning Global index maintenance Oracle9 i R2 Composite range-list partitioning Fast partition split Oracle10 g Global hash indexes Local Index maintenance Oracle10 g R2 1M partitions per table “ Multi-dimensional” pruning Fast drop table
7.
www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.comwww.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com Oracle Partitioning 分区特性 核心功能 性能增强 管理 Oracle8 Range partitioning Global range indexes “ Static” partition pruning Basic maintenance operations: add, drop, exchange Oracle8 i Hash and composite range-hash partitioning Partition-wise joins “ Dynamic” pruning Merge operation Oracle9 i List partitioning Global index maintenance Oracle9 i R2 Composite range-list partitioning Fast partition split Oracle10 g Global hash indexes Local Index maintenance Oracle10 g R2 1M partitions per table “ Multi-dimensional” pruning Fast drop table Oracle Database 11 g More composite choices REF Partitioning Virtual Column Partitioning Interval Partitioning Partition Advisor
www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.comwww.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com 分区对性能的优化 SQL 仅访问相关分区 使用已知值做静态数据修剪 动态修剪使用内部递归 SQL 以找到相关分区 最小化 IO 操作 提供极大的性能收益 S WHERE sales_date BETWEEN ‘01-MAR-2006’ AND ‘31-MAY-2006’; SELECT sum(sales_amount) FROM sales WHERE sales_date BETWEEN ‘01-MAR-2006’ AND ‘31-MAY-2006’; -2006’ AND ‘31-MAY-2006’; ---Sales Table--- 06-Apr 06-Mar 06-May 06-Feb 06-Jan 06-Jun
10.
www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.comwww.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com 分区精简 Sales Table May 22 nd 2008 May 23 rd 2008 May 24 th 2008 May 18 th 2008 May 19 th 2008 May 20 th 2008 May 21 st 2008 Select sum(sales_amount) From SALES Where sales_date between to_date(‘05/20/2008’,’MM/DD/YYYY’) And to_date(‘05/23/2008’,’MM/DD/YYYY’); 2008 年 5 月 20 日到 5 月 23 日的总销售额是多少?
动态分区精简 www.oracledatabase12g.com www.oracledatabase12g.comwww.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com www.oracledatabase12g.com 针对复杂查询存在高级精简的机制 在运行时递归 SQL 语句会自动找出相关分区 关注执行计划中的 PSTAR/PSTOP 字段中的 KEY SELECT sum(amount_sold) FROM sales s, times t WHERE t.time_id = s.time_id AND t.calendar_month_desc IN (‘MAR-04’,‘APR-04’,‘MAY-04’); Sales Table May 2004 June 2004 Jul 2004 Jan 2004 Feb 2004 Mar 2004 Apr 2004 Times Table
Incremental Global Statisticswww.oracledatabase12g.com Sales Table May 22 nd 2008 May 23 rd 2008 May 18 th 2008 May 19 th 2008 May 20 th 2008 May 21 st 2008 Sysaux Tablespace S1 S2 S3 S4 S5 S6 1. Partition level stats are gathered & synopsis created Global Statistic 2. Global stats generated by aggregati ng partition synopsis
27.
Incremental Global StatisticsCont’d Sales Table May 24 th 2008 3. A new partition is added to the table & Data is Loaded www.oracledatabase12g.com May 22 nd 2008 May 23 rd 2008 May 18 th 2008 May 19 th 2008 May 20 th 2008 May 21 st 2008 Sysaux Tablespace May 24 th 2008 S7 4. Gather partition statistics for new partition S1 S2 S3 S4 S5 S6 5. Retrieve synopsis for each of the other partitions from Sysaux Global Statistic 6. Global stats generated by aggregati ng the original partition synopsis with the new one
#5 Partitioning works by very simply splitting database objects into smaller chunks. Operations on the objects simply leave out the chunks they don’t require. There is absolutely no need to change the application in order to exploit this – and we have a huge variety of ways of partitioning the data to suit any type of data. Let’s go into the advantages in a little more detail.
#6 Oracle DW users are universally leveraging partitioning and parallelism. Compression is heavily used, exploited in almost 90% of our survey participants. MVs and VPDs are widespread, touching over two thirds of survey sites.
#7 Partitioning is incredibly well established and a very mature Oracle technology. We have more capability than any other database vendor – and have responded to different customer requirements over the years. Most recently, for example, we have introduced a partition advisor to help customers decide how to partition their tables.
#12 Splitting database objects up also helps manageability. For example if we know that we have all the data for a certain partition, we can simply mark it as read only and we do not need to back it up ever again.
#13 Splitting database objects up also helps manageability. For example if we know that we have all the data for a certain partition, we can simply mark it as read only and we do not need to back it up ever again.
#14 Splitting database objects up also helps manageability. For example if we know that we have all the data for a certain partition, we can simply mark it as read only and we do not need to back it up ever again.
#15 Partitioning gives us a benefit for availability. If a partition is removed from an object, the query can just run on the remainder of the table. This is great for maintenance and archival.
#16 Splitting database objects up also helps manageability. For example if we know that we have all the data for a certain partition, we can simply mark it as read only and we do not need to back it up ever again.
#27 Gathering statistics on one partition (e.g. after a bulk load) causes a full scan of all partitions to gather global table statistics Extremely time and resource intensive Use incremental statistics Gather statistics for touched partition(s) ONLY Table (global) statistics are built from partition statistics