DW Implementation Boot Camp - Student Manual

Embed Size (px)

DESCRIPTION

SDSDS

Citation preview

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    1/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    The following is intended to outline our generalproduct direction. It is intended for informationpurposes only, and may not be incorporated into anycontract. It is not a commitment to deliver anymaterial, code, or functionality, and should not berelied upon in making purchasing decisions.The development, release, and timing of anyfeatures or functionality described for Oraclesproducts remains at the sole discretion of Oracle.

    Safe Harbor Statement

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Use of this Site (Site) or Materials constitutes agreement with the following terms and conditions:

    1. Oracle Corporation (Oracle) is pleased to allow its business partner (Partner) to download andcopy the information, documents, and the online training courses (collectively, Materials") found on thisSite. The use of the Materials is restricted to the non-commercial, internal training of the Partnersemployees only. The Materials may not be used for training, promotion, or sales to customers or otherpartners or third parties.

    2. All the Materials are trademarks of Oracle and are proprietary information of Oracle. Partner or otherthird party at no time has any right to resell, redistribute or create derivative works from the Materials.

    3. Oracle disclaims any warranties or representations as to the accuracy or completeness of anyMaterials. Materials are provided "as is" without warranty of any kind, either express or implied,including without limitation warranties of merchantability, fitness for a particular purpose, and non-infringement.

    4. Under no circumstances shall Oracle or the Oracle Authorized Delivery Partner be liable for any loss,damage, liability or expense incurred or suffered which is claimed to have resulted from use of this Siteof Materials. As a condition of use of the Materials, Partner agrees to indemnify Oracle from and againstany and all actions, claims, losses, damages, liabilities and expenses (including reasonable attorneys'fees) arising out of Partners use of the Materials.

    5. Reference materials including but not limited to those identified in the Boot Camp manifest can not beredistributed in any format without Oracle written consent.

    Oracle Training Materials Usage

    Agreement

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    Title of Presentation

    Presenters NamePresenters Title

    Data Warehouse course introduction

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    2/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Module Agenda

    Introductions

    Introduction to data warehousing

    Creating business value from IT

    Data warehouse architecture & design

    Preparing for the hands-on labs

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Introductions

    The goals of this course

    Provide background to understand technicalchallenges presented by data warehouses

    Provide a technical overview of the Oracle Database11g Data Warehousing features with extensivehands-on labs

    Guidelines on sizing of Data Warehouse hardwareconfigurations

    Share best practices for deploying Oracle DataWarehouse architectures and platforms

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Introductions

    Who are you? Name

    Company

    Role

    What is your prior experience? Database administration

    Data warehouse experience

    10g or 11g Database experience

    How do you expect to benefit from this course?

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    3/118

    Introductions

    Who am I?

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Course modules

    Introduction to data warehousing

    Introduction to Oracle data warehouse features

    Parallel execution - Lab

    Partitioning - Lab

    Result Cache - Lab

    OLAP - Lab

    Advanced compression - Lab

    Data integration and ETL- Demo

    Course modulesContinued

    Sizing Oracle data warehouse platforms

    Exadata overview

    Best practices for performance

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Introduction to data

    warehouses

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    4/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    All about data warehousesWhat is a data warehouse?

    A data warehouse is A repository of data

    From multiple sources

    Used for analysis

    Strategic value is realized from data aggregation

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    All about data warehousesWhy have a data warehouse?

    Increase the value inherent in data

    Extract strategic information from tactical data

    Drive IT value into business results

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    All about data warehousesHow is a data warehouse different from OLTP?

    Read-mainly

    Typically, real-time not required

    Large data sets

    Complex queries based on many factors

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    All about data warehousesHow is a data warehouse the same as OLTP?

    Modern data warehouses Near real time

    Mixed workloads

    ETL

    OLTP

    Write operations make OLTP issues relevant

    Performance

    Locking

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    5/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    All about data warehousesUsing a data warehouse

    Data

    WarehouseCustomers Web

    Servers

    Personalization

    Content

    Servers

    Fulfillment

    Centers

    Supply

    Chain

    Planning

    Apps

    Financial

    Analysis

    Campaign

    Generation Email

    Servers

    Internal

    End Users

    Partners

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    All about data warehousesUsing a data warehouse Amazon.com

    0

    100

    200

    300

    400

    500

    600

    700

    Terabytes

    2000

    2001

    2002

    2003

    2004

    2005

    2006

    2007

    2008

    2009

    2010

    NA

    FE

    EU

    Data Volume has grown 2x year over year for the past 4 years.Projecting higher growth in upcoming years*:

    - additional lines of business / product lines supported- huge standard reporting growth with more partners supported

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Creating business value

    from IT

    Creating business value from IT

    IT PRIORITIES BUSINESS PRIORITIES

    Reduced Cost Business Value

    Improved Security Ease of Access

    Improved SystemPerformance

    Results in Timefor Deadlines

    Manageability /Consistency

    Good Enough Infrastructure

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    6/118

    Creating business value from IT

    Increasing Return on Investment for informationproducers by Reducing current costs of analysis for lines of business

    Empower LOBs with tools, applications, and automatedanalysis rather than manually creating custom reports

    Reducing ongoing costs of analysis for IT

    Faster and simpler development of analytic applications

    Centralized management

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Creating business value from IT

    Increasing Return on Investment for informationconsumers in lines of business by Enabling top-line growth

    New customers/markets, best customers,

    React faster than the competition

    Enabling bottom-line savings

    Optimize operations, mitigate risk,

    Better manage the business than the competition

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Data warehouse

    architecture and design

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Data warehouse architecture and designArchitecture

    Data warehouse

    Operational data store

    Data marts

    Federated data marts

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    7/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Data warehouse architecture and designData design

    Analysis performed on a set of facts Examined through different dimensions

    Usually has time dimension

    Queries typically examine facts with many dimensions

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Data warehouse architecture and designDesign options

    Star schema

    Snowflake schema

    OLAP cubes

    Hybrid organization

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Data warehouse architecture and designDesign options Star schema

    SalesSales

    DistributorDistributorOEMOEM

    ChannelChannel Geography Geography

    TypeType

    SizeSize

    ColorColor

    ProductProduct TimeTime

    YearYear

    QuarterQuarter

    MonthMonth

    RegionRegion

    DistrictDistrictBranchBranch

    Fact Table:Fact Table:

    SalesSales

    TransactionsTransactions

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Data warehouse architecture and designDesign options Snowflake schema

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    8/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Data warehouse architecture and designDesign options OLAP cubes

    Product

    Sales Cube

    Inventory Cube

    SALES FACTSALES FACT

    TIME

    INVENTORYINVENTORY

    REGION

    CUST

    ITEM

    TimeGeography

    Product

    Time

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Data warehouse architecture and designDesign options Hybrid organization

    Combination of structures Star schema

    OLAP cubes

    Third normal form

    Oracle query optimizer can handle appropriately forall structures

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Lab Setup

    Lab setup - Connection

    Instructions for dialing in to hosted image

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    9/118

    Lab setup - Testing

    Login to the VM Linux environment with oracle/oracle

    Open a new command window

    Start a SQL Plus session as SH/SH

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Lab setup VM environment overview

    All passwords for OS & Oracle logins are same as theusername

    Except - root, SYS, SYSTEM, and SYSMAN areoracle

    All the lab scripts are stored in the/home/oracle/wkdirdirectory

    Few shortcuts:

    Command

    Window

    Firefox

    Browser

    Analytic

    Workspace

    Manager

    SQL

    Developer

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Summary

    A data warehouse is a way to provideadditional value from existing data

    Data warehouse architectures can includeoperational data stores, federated datamarts and data marts

    Data warehouses can use star schemas,snowflake schema, OLAP cubes, thirdnormal form or a mixture of differentstructures

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    10/118

    For Oracle employees and authorized partners only. Do not distribute to third parties.

    2008 Oracle Corporation Proprietary and ConfidentialFor Oracle employees and authorized partners only. Do not distribute to third parties.

    2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    Title of Presentation

    Presenters NamePresenters Title

    Data Warehouse and Business Intelligenceoverview

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Module Agenda

    Why Oracle for data warehousing?

    Core data warehousing features

    Oracle 11g data warehousing features

    Oracle hardware data warehouse solutions

    Analytics and data mining

    Oracle Business Intelligence Platform (OBIEE)

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    11/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Why Oracle for data

    warehousing?

    Why Oracle for data warehousing?

    Best-of-breed for data warehouses and data marts

    Consolidation platform Eliminates the costs and inefficiencies of multiple data stores

    Complete, integrated ELT and data-qualitycapabilities

    Unmatched analytic capabilities Embedded OLAP, data-mining and statistics all accessible via

    SQL

    Optimized for grid computing

    Next-generation BI with integrated OLTP and DSS

    Optimized hardware solutions

    Foundation of Oracle Business Intelligence solutions

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle - #1 in data warehouse market

    share

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehousing

    features

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    12/118

    Oracle data warehouse platform

    DW Services

    Administration

    Workload Mgmt

    Self-Tuning

    Security

    Virtual PrivateDatabase

    Database Vault

    Data Integration

    Bulk ETL + Real-TimeETL

    Data Quality

    Metadata ManagementExtensibleRepository

    Lineage and ImpactAnalysis

    Brainy Software

    Analytics

    Multi-DimensionalCalculations

    Statistics Data Mining

    Intelligent Query Processing

    MaterializedViews

    BitmapIndexes

    PartitionElimination

    Star QueryOptimization

    Brawny Hardware

    Scalable Data Management

    ParallelExecution

    Partitioning RACAutomatic

    StorageMgmt

    Compression

    Scalable Hardware Infrastructure

    ReferenceConfigurations

    OptimizedWarehouse

    ExadataDatabaseMachine

    ExadataStorage Server

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresBit-mapped indexes

    PARTStable 001001 GREENGREEN MEDMED 98.198.1

    002002 REDRED MEDMED 12411241003003 REDRED SMALLSMALL 100.1100.1004004 BLUEBLUE LARGELARGE 54.954.9005005 REDRED MEDMED 124.1124.1006006 GREENGREEN SMALLSMALL 60.160.1...... ........ .......... ......

    sizesize == SMALLSMALL 0 0 1 0 1 1 0 1 0 1 0 0 0 1 0 10 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1sizesize == MEDMED 1 0 0 0 0 0 1 0 0 0 0 1 0 1 0 01 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0sizesize == LARGELARGE 0 1 0 1 0 0 0 0 1 0 1 0 1 0 1 00 1 0 1 0 0 0 0 1 0 1 0 1 0 1 0

    Index on COLOR

    colorcolor == BLUEBLUE 0 1 0 1 0 0 1 0 1 0 1 0 0 0 1 00 1 0 1 0 0 1 0 1 0 1 0 0 0 1 0colorcolor == REDRED 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 10 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1colorcolor == GREENGREEN 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 01 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0

    010

    010

    010

    010

    partnopartno color color sizesize weightweight

    Index on SIZE

    SELECT count(*)

    FROM parts

    WHERE

    size = MED a AND

    color = RED

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresParallel bit-mapped star joins

    Dramatic performance gains

    Innovative use of bitmap indexes

    Ideal for complex star schemas Multiple fact tables

    Many dimensions

    Unconstrained dimensions

    Large dimension tables

    Optimized for sparse fact tables

    Parallel execution

    Optimizer modifies an SQL query for fasterperformance with star schema

    Bitmapped indexes used to select rows from facttables Replaces multiple joins

    Results are joined to dimension tables for additionalinformation

    Must enable in database and conform to constraints

    Core data warehouse featuresStar transformation

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    13/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresMaterialized views

    What were salesWhat were salesin the West andin the West and

    South regions forSouth regions for

    the last threethe last three

    quarters?quarters?

    x

    (2 GB)

    SALESSALESSALESSALES

    SALESSALESPERPER

    MONTHMONTHBY REGIONBY REGION

    SALESSALESPERPER

    MONTHMONTHBY REGIONBY REGION

    Stored summaries aremaintained for fasterwarehouse queryprocessing

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresMaterialized views query rewrite

    SELECT p.brand, r.country, t.month,SUM(s.amt) tot_sales

    FROM sales s, region r,time t, product p

    WHERE s.region_id = r.region_idAND s.sdate = t.curdateAND s.prod_code = p.prod_codeGROUP BY p.brand, r.country, t.monthHAVING SUM(s.amt) > 5000000;

    SELECT brand, country, month, tot_salesFROM sales_sumryWHERE tot_sales > 5000000;

    Optimizer

    transparently

    rewrites queryon detailed

    data ...

    Optimizer

    transparently

    rewrites queryon detailed

    data ...

    to access

    data in the

    materialized

    view

    to access

    data in the

    materialized

    view

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresMaterialized views data refresh

    Maintain the timeliness of storedresult to preference

    Several options for refreshing datain materialized views

    Manage the effect of performanceon operational data

    No impact on load performance

    SUMSUMORDERSORDERSbyby

    QUARTERQUARTER

    COUNTORDERS

    byPRODUCT

    AVGORDERS

    byREGION

    InsertInsert

    UpdateUpdate

    DeleteDelete

    InsertInsert

    UpdateUpdate

    DeleteDelete

    DeferredDeferredRefreshRefresh

    FullFullRefreshRefresh

    ORDERSORDERS

    IncrementalIncrementalRefreshRefresh

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresParallel execution

    select c.cust_last_name

    , sum(s.amount_sold)

    from customers c, sales s

    where c.cust_id = s.cust_id

    group by c.cust_last_name;

    Data on Disk Parallel Servers

    scanscan

    scanscan

    scanscan

    aggregateaggregate

    Scanners

    Coordinator

    joinjoin

    joinjoin

    joinjoin

    aggregateaggregate

    aggregateaggregate

    Joiners Aggregators

    RAC aware!

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    14/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresPartitioning

    Core functionality Performance Manageability

    Oracle8 Range partitioning

    Global range indexes

    Static partitionpruning

    Basic maintenanceoperations: add,drop, exchange

    Oracle8i Hash and compositerange-hash partitioning

    Partition-wise joins

    Dynamic pruning

    Merge operation

    Oracle9i List partitioning Global indexmaintenance

    Oracle9iR2 Composite range-listpartitioning

    Fast partition split

    Oracle10g Global hash indexes Local Indexmaintenance

    Oracle10gR2 1M partitions per table Multi-dimensionalpruning

    Fast drop table

    OracleDatabase 11g

    More composite choicesREF PartitioningVirtual Column Partitioning

    Interval PartitioningPartition Advisor

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresData compression

    Tables and indexes can be compressed Can be specified on a per-partition basis

    Typical compression ratio 4:1

    Requires more CPU to load data Decompression minimal resource cost

    Compress for all DML operations

    Less data on disk Requires less time to read

    Little or no impact on query performance

    Completely transparent

    Especially applicable to data warehouses

    4XCompression

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresData compression real world examples

    0

    500

    1000

    1500

    2000

    2500

    Table Scans

    0

    0.1

    0.2

    0.3

    0.4

    2.5x Faster

    DML Performance

    0

    10

    20

    30

    40

    < 3% Overhead

    3x Saving

    Data Storage

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresDatabase Resource Manager

    High PrioritySales Analysis20 users

    (DOP 10)

    Medium PriorityAd Hoc Reports200 users

    (DOP 4)

    Low PriorityETL Jobs

    200 users

    (DOP 4)

    Protect the system pro-actively Maximum number of concurrent operations

    Control CPU and IO consumption based on Consumer Groups

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    15/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresSQL Access Advisor

    Based on workload

    Materialized view advice

    Index advice

    Partition advice

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresSQL Access Advisor how it works

    Indexes Material izedviews

    Materializedviews log

    SQL AccessAdvisor

    Hypothetical

    SQL cache

    FilterOptions

    STS

    CompleteWorkload

    Partitionedobjects

    Hashpartitions?

    Intervalpartitions?

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresOracle Warehouse Builder

    Design Target WarehouseDesign Target Warehouse1

    2 Define SourcesDefine Sources

    Relational Flat Files Applications Mainframe

    Map Source to TargetMap Source to Target3

    Oracle or flat files

    Generate CodeGenerate Code4

    Instantiate WarehouseInstantiate Warehouse5

    6 Extract & transform data

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresOracle Warehouse Builder - Repository

    Multi-user repository Single update, multi-read

    Object locking

    Synchronize

    Metadata import / export &interchange Bridges to Oracle tools, ERwin,

    PowerDesigner

    Bridges to other metadata availablefrom Metadata Integration Technology

    Incorporated

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    16/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresOracle Data Integrator

    Next Generation Architecture

    E-LTE-LTLoadExtract

    Transform Transform

    Conventional ETL Architecture

    Extract LoadTransform Performance

    Heterogeneous E-LT

    Productivity Declarative design

    Flexibility Active integration design

    Easily extendable Knowledge modules

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresReal Application Clusters

    QueryQueryQueryQueryETL ETL ETL ETL

    Data Warehouse

    Scale across cluster

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresReal Application Clusters

    QueryQueryETL ETL

    Data Warehouse

    Scale across cluster

    Dedicate nodes tospecific work

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresReal Application Clusters

    QueryQueryETL ETL

    Data Warehouse

    Scale across cluster

    Dedicate nodes tospecific work

    Scale out whenworkload increases

    Query

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    17/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Spreads database files acrossall available storage for optimalperformance and resourceutilization

    Enables simple, online resourceallocation and providesautomatic data rebalancing

    Up to 3-way mirroring

    Can leverage external hardwareRAID mirror and parity protection

    Core data warehouse featuresAutomatic Storage Management (ASM)

    Oracle OLAP OptionEmbedded, manageable, enterprise-ready

    A multidimensional calculation and aggregation engine Multidimensional data types: Cubes and dimensions

    An OLAP API for cube definition and multidimensional queries

    A SQL interface to OLAP Cubes and dimensions

    Embedded in the Oracle Database Runs within Oracle instance on same server

    OLAP cubes are stored in Oracle data f iles

    OLAP metadata in the Oracle Data D ictionary

    All key database functionality extends to OLAP Security: Object and data security

    Scalability: Real Application Clusters

    Availability: Backup-Recovery, Disaster Recovery, RAC

    Administration: Enterprise Manager

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Why Oracle OLAP is so FastData Access Method

    Data stored in dense arrays

    Offset addressing no joins

    More powerful analysis

    Better performance

    Time

    Product

    CD

    ProfitDVD

    Audio

    Q1 Q2 Q3SF

    West

    USA

    Market

    Compare Profit this Quarter versus Last Quarter

    What is a Products Profit Share of its Category?

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Core data warehouse featuresCurrent adoption

    0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%

    DB Res Mgr

    RMAN

    ASM

    Read Only

    VPD

    MV Use

    Compression

    Parallel Exec

    Partitioning

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    18/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle 11g data

    warehousing features

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle 11g data warehouse featuresData Result Cache

    Automatically caches results of queries, query blocks, or PL/SQLfunction calls

    Cache is shared across statements and sessions on serv er

    Significant speed up for read-only / read-mostly data

    Full consistency and proper semantics

    Cache refreshed when any underlying table updated

    join

    join

    Table1 Group-by

    join

    Table2 Table3

    Q2: Uses resulttransparentlycache

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle 11g data warehouse featuresData Results Cache

    Retail customer data (~50 GB) Concurrent users submitting queries randomly

    Executive dashboard with 12 heavy analytical queries

    Cache results only at in-line view level

    12 queries run in random, different order 4 queries cached

    Measure average, total response time for all users

    447 s

    267 s

    186 s

    No cache

    334 s

    201 s

    141 s

    Cache

    25%

    25%

    24%

    Improvement

    8

    4

    2

    # Users

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle 11g data warehouse featuresSQL PIVOT/UNPIVOT

    Rotate rows into columns and vice versa Common operation for crosstab queries

    PROD QUARTER AMOUNT

    Shoes Q1 2000

    Shoes Q2 1000

    Jeans Q1 1000

    Jeans Q3 500

    Jeans Q3 100Jeans Q4 1000

    PROD Q1 Q2 Q3 Q4

    Shoes 2000 1000 Null Null

    Jeans 1000 Null 600 1000

    SELECT * FROM tPIVOT (sum(amount)

    FOR quarter inQ1,Q2,Q3,Q4);

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    19/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle 11g data warehouse featuresAdditional features

    Enhanced partitioning options

    Advanced compression

    OLAP-based materialized views

    Priority-dependent maximum degree of parallelism inDatabase Resource Manager

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle data warehousing

    hardware

    CustomCustom

    Complete Flexibility

    Any OS, any platform

    Easy fit into acompanys ITstandards

    Oracle DW Hardware SolutionsThe evolution of hardware infrastructure

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    CustomCustom

    Complete Flexibility

    Any OS, any platform

    Easy fit into acompanys ITstandards

    Documented best-practiceconfigurations fordata warehousing

    ReferenceConfigurations

    ReferenceConfigurations

    Oracle DW Hardware SolutionsThe evolution of hardware infrastructure

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    20/118

    CustomCustom

    Complete Flexibility

    Any OS, any platform

    Easy fit into acompanys IT

    standards

    Documented best-practiceconfigurations fordata warehousing

    Optimized

    Warehouse

    Optimized

    Warehouse

    Scalable systemspre-installed and pre-

    configured: ready torun out-of-the-box

    Reference

    Configurations

    Reference

    Configurations

    Oracle DW Hardware SolutionsThe evolution of hardware infrastructure

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    CustomCustom

    Complete Flexibility

    Any OS, any platform

    Easy fit into acompanys IT

    standards

    Documented best-practiceconfigurations fordata warehousing

    Optimized

    Warehouse

    Optimized

    Warehouse

    Scalable systemspre-installed and pre-

    configured: ready torun out-of-the-box

    Highest performance

    Pre-installed and pre-configured

    Sold by Oracle

    Reference

    Configurations

    Reference

    ConfigurationsSun Oracle

    Database

    Machine

    Sun Oracle

    Database

    Machine

    Oracle DW Hardware SolutionsThe evolution of hardware infrastructure

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Build From Scratchwith Components

    OWI ReferenceConfigurations

    Take delivery of OWI

    configuration

    Weeks to Months

    Pre-implementationSystem sizing

    Acquisition ofcomponents

    Installation andconfiguration

    Acquisition ofcomponents

    Installation andconfiguration

    Testing andValidation

    Testing andValidation

    Weeks to Months

    Sun OracleDatabase Machine

    Faster deploymentLower Risk

    < 1 Week

    Database Machine BenefitsAccelerate Implementations & Lower Risk

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Analytics and data

    mining

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    21/118

    SQL analytics

    Bring Algorithms to the Data - Not Data tothe Algorithms

    Analytic computationsdone in the database SQL analytics

    Statistics

    OLAP

    Data Mining

    Scalability

    Security

    Backup & Recovery

    Simplicity

    OLAP

    Data Mining

    Statistics

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Why Data Mining?Do you wish to ..

    Identify factors most associated with a business problem?

    Predict customer behavior ?

    Predict or estimate a value ?

    Find profiles of targeted people or items?

    Segment a population ?

    Determine important relationships/market baskets within thepopulation ?

    Find fraudulent or rare events ?

    (Attribute Importance)

    (Classification)

    (Regression)

    (Decision Trees)

    (Clustering)

    (Associations)

    (Anomaly Detection)

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Statistics & SQL Analytics

    Ranking functions rank, dense_rank, cume_dist, percent_rank, ntile

    Window Aggregate functions(moving and cumulative)

    Avg, sum, min, max, count, variance, stddev,first_value, last_value

    LAG/LEAD functions Direct inter-row reference using offsets

    Reporting Aggregate functions Sum, avg, min, max, variance, stddev, count,

    ratio_to_report

    Statistical Aggregates Correlation, linear regression family, covariance

    Linear regression Fitting of an ordinary-least-squares regression line

    to a set of number pairs.

    Frequently combined with the COVAR_POP,COVAR_SAMP, and CORR functions.

    Descriptive Statistics average, standard deviation, variance, min, max, median (via

    percentile_count), mode, group-by & roll-up

    DBMS_STAT_FUNCS: summarizes numerical columns of atable and returns count, min, max, range, mean, stats_mode,variance, standard deviation, median, quantile values, +/- nsigma values, top/bottom 5 values

    Correlations Pearsons correlation coefficients, Spearman's and Kendall's

    (both nonparametric).

    Cross Tabs Enhanced with % statistics: chi squared, phi coefficient,

    Cramer's V, contingency coefficient, Cohen's kappa

    Hypothesis Testing Student t-test , F-test, Binomial test, Wilcoxon Signed Ranks

    test, Chi-square, Mann W hitney test, Kolmogorov-Smirnovtest, One-way ANOVA

    Distribution Fitting Kolmogorov-Smirnov Test, Anderson-Darling Test, Chi-

    Squared Test, Normal, Uniform, Weibull, Exponential

    Pareto Analysis 80:20 rule, cumulative results table

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle Data Mining OptionEmbedded, manageable, enterprise-ready

    A complete data-mining solution 10+ data-mining algorithms: addresses every business scenario

    Generalized Linear Models (Logistic & Multiple Regression)

    Oracle Data Miner: Graphical user-interface for analysts

    A Data Mining PL/SQL & Java API for developers

    Embedded in the Oracle Database Runs within Oracle instance on same server

    Data Mining algorithms execute directly on database t ables

    Data Mining models and metadata stored within Oracle database

    All key database functionality extends to Data Mining Scalability: Parallelism, Real Application Clusters

    Security: Object and data security

    Administration: Enterprise Manager Portability: All major platforms

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    22/118

    Oracle Data MiningOracle in-Database Mining Engine

    Oracle Data Miner (GUI) Simplified, guided data mining

    Spreadsheet Add-In forPredictive Analytics 1-click data mining from a

    spreadsheet

    PL/SQL API & Java (JDM) API Develop advanced analytical

    applications

    Wide range of algorithms

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle Business

    Intelligence

    OLTP & ODSSystems

    DataWarehouseData Mart

    Oracle Business Intelligence EEData warehouse components

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    OLTP & ODSSystems

    DataWarehouseData Mart

    SAP, OraclePeopleSoft, Siebel,

    Custom Apps

    FilesExcelXML

    BusinessProcess

    Oracle Business Intelligence EEFull data foundation

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    23/118

    OLTP & ODSSystems

    DataWarehouseData Mart

    SAP, OraclePeopleSoft, Siebel,

    Custom Apps

    FilesExcelXML

    BusinessProcess

    Oracle BI Server

    Common Enterprise Information Model

    Oracle Business Intelligence EECommon information model

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    OLTP & ODSSystems

    DataWarehouseData Mart

    SAP, OraclePeopleSoft, Siebel,

    Custom Apps

    FilesExcelXML

    BusinessProcess

    Oracle BI Server

    Common Enterprise Information Model

    Reporting&

    Publishing

    Ad hocAnalysis

    ProactiveDetectionand Alerts

    MicrosoftOffice

    InteractiveDashboards

    Advantages:

    Consolidate and

    standardize BI

    tools

    Unified BI

    metadata and

    infrastructure

    Seamless BI userexperience

    Intelligent

    Caching Services

    Data Federation

    Intelligent Alerting

    Oracle Business Intelligence EEComprehensive, integrated BI suite

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle BI Enterprise Edition Plus

    (OBIEE+)

    OLTP & ODSSystems

    DataWarehouseData Mart

    SAP, OraclePeopleSoft, Siebel,

    Custom Apps

    FilesExcelXML

    BusinessProcess

    PerformanceManagementApplications

    Insight

    PerformanceAction

    SetGoals

    Plan

    Monitor

    Analyze

    Report

    Align

    HyperionEssbase

    Oracle BI Server

    Common Enterprise Information Model

    Reporting & Publishing

    Financial Reporting

    BI Publisher

    Interactive Reporting

    SQR Production Reporting

    Web Analysis

    Ad hocAnalysis

    ProactiveDetectionand Alerts

    MicrosoftOffice

    InteractiveDashboards

    Extend

    ODBC

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Summary

    Oracle has many features to enhance datawarehouse operations

    Oracles data warehouse features areimplemented transparently to developers

    Oracles data warehouse features areintegrated with the Oracle database

    Oracle has evolved the hardwareinfrastructure of data warehouses topreconfigured optimized warehouses

    Oracle offers a complete set of analytic andbusiness intelligence capabilities

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    24/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties.

    2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    Title of Presentation

    Presenters NamePresenters Title

    Parallel execution

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    25/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Module Agenda

    Parallel execution overview

    Parallel execution setup

    Parallel joins

    Parallel execution with RAC

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Parallel execution

    overview

    What is parallel execution?

    With parallel execution, a task is Broken into smaller sub-tasks, which are executed independently in

    parallel, with the result joined at completion

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    SELECT c.cust_last_name, sum(s.amount_sold)FROM customers c, sales s

    WHERE c.cust_id = s.cust_idGROUP BY c.cust_last_name;

    Data on Disk Parallel Servers

    scanscan

    scanscan

    scanscan

    aggregateaggregate

    Coordinator

    joinjoin

    joinjoin

    joinjoin

    aggregateaggregate

    aggregateaggregate

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    SQL Parallel Execution

    QC is theQC is the user session that initiates the parallel SQL statementuser session that initiates the parallel SQL statement& it will& it will distribute the work to parallel serversdistribute the work to parallel servers

    Parallel serversParallel servers -- individual sessions that performindividual sessions that perform

    work in parallel They are allocated from awork in parallel They are allocated from a pool ofpool ofglobally available parallel server processes andglobally available parallel server processes andassigned to a given operationassigned to a given operation

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    26/118

    Dynamic parallelismAdvantages

    Uses granules

    Advantages Uses optimal queueing technique

    Avoids convoy effect

    Adaptable to changing conditions

    Structural

    Runtime

    Allow partitioning based on business requirements

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Parallel executionParallel scans

    Data is partitioned into granules(block range or partition) Dynamic Granules Computed

    during runtime by the database

    Each scan parallel process isassigned multiple granules

    No two scanners ever contendfor the same granule

    Granules are assigned so thatthe load is balanced across allparallel scan processes

    PQ #2

    PQ #3

    PQ #1

    Parallel ExecutionServers

    Parallel executionIntra- and inter-operation parallelism

    PQ 1

    PQ 2

    PQ 3

    PQ 4

    Sales tableFull ScanParallel Sort

    A - C

    D - F

    G - M

    N - O

    PQ 5

    PQ 6

    PQ 7

    PQ 8

    S

    T - V

    W - Z

    P - R

    SELECT ... FROM product p, sales s where p.prod_id = s.prod_id ORDER BY p.prodname;

    UserProcess

    QueryCoordinator

    Intra-Parallelism Intra-Parallelism

    DOP = 8(Intra-Parallelism)

    DOP = 16(Inter-Parallelism)

    Inter-Parallelism

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Parallel executionParallel scans of multiple tables

    SELECT c.cust_name, s.date,

    s.amount

    FROM sales s, customers c

    WHERE s.cust_id= c.cust_id;

    Querycoordinator

    SALES

    Table

    CUSTOMERS

    Table

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    27/118

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    28/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Parallel executionParallel scans of multiple tables

    SELECT c.cust_name, s.date,

    s.amount

    FROM sales s, customers c

    WHERE s.cust_id= c.cust_id;

    Querycoordinator

    P1 P2 P3 P4

    SALES

    Table

    CUSTOMERS

    Table

    Assembly

    Degree of Parallelism = number of parallel execution serversassociated with a parallel operation

    Assigned for database, object, session or query DOP is calculated at run-time

    Default DOP (when not specified) =CPU_COUNT xPARALLEL_THREADS_PER_CPU

    DOP may be reduced depending on the availability of parallelexecution servers and system load

    Database Resource Manager can throttle DOP per resourceconsumer groups

    Parallel executionDegree of Parallelism (DOP)

    DOP applies to intra-operation parallelism In inter-operation pallelism, parallel execution servers

    can be twice the number specified by the DOP No more than two sets of parallel execution servers

    can be used for one parallelized statement at a time

    Parallel executionDegree of Parallelism (DOP) - continued

    SQL Access Methods Table Scans

    Fast Full Index Scans

    Partitioned Index Range Scans Sorts, Aggregations, Set Operations

    External Table access Joins

    Nested Loop, Sort-Merge Hash, Star, Partition-Wise

    DDL CTAS, CREATE INDEX, REBUILD INDEX

    DML INSERT-SELECT, UPDATE, DELETE, MERGE

    Parallel executionParallelizable operations

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    29/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Parallel execution setup

    Parallel Execution Server Pool Server pool size is determined by PARALLEL_MIN_SERVERS

    and PARALLEL_MAX_SERVERS Dynamic based on demand

    Adaptive Multiuser and DOP PARALLEL_ADAPTIVE_MULTI_USER = TRUE (default) Throttles DOP to prevent overloading of server

    PARALLEL_MIN_PERCENT is the minimum parallel executionservers requested for the operation

    Default 0 Disabled Operation not executed if the MIN % of DOP servers not available

    Parallel execution setupConfiguration

    Enabling Parallel DML, DDL and QueryALTER SESSION (ENABLE | DISABLE | FORCE) PARALLEL

    (DML | DDL | QUERY) (PARALLEL n);

    FORCEPARALLEL overrides default DOP Hints overrides a forced DOP

    Parallel Query & Parallel DDL is enabled if ANY ofbelow is TRUE

    Object was created with PARALLEL clause ALTER SESSION [ENABLE|FORCE]PARALLEL Parallel hints are specified in the query

    Parallel DML enabled if both are TRUE ALTER SESSION [ENABLE|FORCE]PARALLEL Object was created with PARALLEL clause OR Parallel

    Hints are specified in DML

    Parallel execution setupExecution

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Paralleljoins

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    30/118

    Serial Join

    scan scan

    join

    Products Sales

    Sales.prod_id = products.prod_id

    Scan of both tablesin serial

    Compares (joins) allrecords from saleswith products

    Basic Parallel Join

    scan scan

    join

    scan scan

    join

    Sales.prod_id = products.prod_id

    Scan of both tablesin parallel

    Compares (joins) allrecords from saleswith products

    Products Sales

    Parallel Join with Broadcasting

    scan scan

    join

    scan

    join

    Sales.prod_id = products.prod_id

    Scan of both tablesin parallel/serial

    Compares (joins) allrecords from saleswith products

    Products Sales

    Smaller table isbroadcast to all

    processes

    Parallel Join with Broadcasting

    scan scan

    join

    scan

    join

    Sales.prod_id = products.prod_id

    Scan of both tablesin parallel/serial

    Compares (joins) allrecords from saleswith products

    Smaller table isbroadcast to allprocesses

    No data distributionfor large table

    Products Sales

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    31/118

    Parallel processesData Redistribution Methods

    HASH Standard redistribution for parallel processing

    Example JOIN, GROUP BY operations

    KEY Ensures the logical clumping of KEY values

    RANGE Used for combined GROUP BY and ORDER BY operations

    BROADCAST Sends smaller data sets to all participating processes to

    optimize data shipping

    ROUND ROBIN Final operation to send data to requesting process

    Variance LOCAL as RAC optimization

    Partition-wise Join

    scan scan

    join

    Sales.prod_id = products.prod_id

    Products Sales

    Scan of both tablesin serial

    Compares (joins) allrecords from saleswith products

    Equi-partitioning oftables will beleveraged

    Partition-wise Parallel Join

    scan scan

    join

    scan scan

    join

    Sales.prod_id = products.prod_id

    Products Sales

    Scan of both tablesin serial

    Compares (joins) allrecords from saleswith products

    Equi-partitioning oftables will beleveraged

    No data distributionrequired

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Parallel execution with

    RAC

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    32/118

    Parallel Query

    PQ 1

    PQ 2

    PQ 3

    PQ 4

    Sales tableFull ScanParallel Sort

    A - C

    D - F

    G - M

    N - O

    PQ 5

    PQ 6

    PQ 7

    PQ 8

    S

    T - V

    W - Z

    P - R

    SELECT ... FROM product p, sales s where p.prod_id = s.prod_id ORDER BY p.prodname;

    UserProcess

    QueryCoordinator

    Internode Parallel Query

    PQ 1

    PQ 2

    PQ 3

    PQ 4

    Sales tableFull ScanParallel Sort

    A - C

    D - F

    G - M

    N - O

    PQ 5

    PQ 6

    PQ 7

    PQ 8

    S

    T - V

    W - Z

    P - R

    SELECT ... FROM product p, sales s where p.prod_id = s.prod_id ORDER BY p.prodname;

    UserProcess

    QueryCoordinator

    Node 1

    Node 2

    Many large-scale DWs have many concurrent jobs

    Multiple small-to-medium size queries

    Degree of parallelism < CPUs-per-node

    With Oracle, queries will automatically run on a single node,eliminating traffic over the interconnect

    RAC and Parallel Execution

    Q1 Q2 Q4Q3

    Q5 Q7Q6 Q8

    Q9 Q12Q11Q10

    Very large queries utilize all resources on thecluster

    RAC and Parallel Execution

    Large Query

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    33/118

    RAC and parallel executionAllocating parallel execution servers

    If no DOP has been set for the object, session orthrough a hint, RAC uses parallel servers from acrossall nodes.

    Else, if DOP < 2 times the number of CPUs on anode, RAC will first attempt to use parallel executionprocesses on owner node

    If DOP is too high or if enough local parallel serverprocess are not available, processes spread overmultiple nodes

    P1 P1 P2 P2 P3 P3 P4 P4

    Node 1 Node 2

    PX1 PX2 PX3 PX4

    Internode Parallel QuerySample optimizations

    Classical co-located partition-wise join A partition-wise parallel join is used if the DOP is either equal to

    the number of partitions, or an even divisor of the number ofpartitions

    If there were 16 partitions, a partition-wise parallel join wouldwork with a DOP of 16, 8, 4 or 2

    Example shown 2 nodes, 4 partitions on 2 tables, DOP 4

    P1 P1 P2 P2 P3 P3 P4 P4

    Node 1 Node 2

    Internode Parallel QuerySample optimizations

    Without partition-wise parallel join, data redistributionmust occur, which can stress interconnect Sample join of two tables, each with 4 partitions, on 2 nodes,

    DOP 8

    PX1 PX2 PX3 PX4 PX5 PX6 PX7 PX8

    Parallel Operations with RACUsing services

    PARALLEL_INSTANCE_GROUPS andINSTANCE_GROUPS nolonger used to controlparallelism across RACnodes

    Services specify whichnodes can participate inparallel execution

    Connection of a processto a service throughsql*net can contain theparallel execution

    Define service thru OEM

    or (DB and srvctl) thenadd to tnsnames.ora

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    34/118

    Summary

    Oracle uses dynamic parallelism

    The degree of parallelism is dynamicallycalculated, based on several factors

    Parallel partition-wise joins are theperformance goal

    Parallelism is properly supported with RAC

    Instance groups or services can limitparallelism to specific nodes with RAC

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties.

    2008 Oracle Corporation Proprietary and ConfidentialFor Oracle employees and authorized partners only. Do not distribute to third parties.

    2008 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    35/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    Title of Presentation

    Presenters NamePresenters Title

    Partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Module Agenda

    Partitioning benefits

    Partitioning options

    Index partitioning

    Partition operations

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partitioning benefits

    Dividing a table or index into smaller portions,based on a partition key

    Partitioning transparent to applications and users

    PartitioningDefinition

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    36/118

    Partition pruning

    Optimizer eliminates unneeded partitions for data access

    Improves query performance by several orders (FTS .vs. FPS)

    Prunes range or list partitioning for LIKE, equality, and IN-list

    Prunes hash partitioning for equality and IN-list

    Static and dynamic partition pruning

    Partition-wise join

    Used when two tables are joined together and when both the tables arepartitioned on the join key

    Breaks the large join into smaller joins that occur between each of thepartitions

    Significantly reduces response time and improves the use of both CPU andmemory resources

    Partitioning benefitsPerformance

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Maintenance operations can address smallerpartitions rather than full table or index

    Maintenance operations like DROP, SPLIT,COALESCE make it easy to adjust partitions

    Partitions support a 'rolling window load or purgeprocess

    Partitioning benefitsManageability

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partitioned database objects provide partitionindependence

    Important part of a high-availability strategy

    Reduce scheduled downtime

    Partitioning benefitsAvailability

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partitions can be stored on different storage tiers

    Archived partitions can be stored on cheaper storagedevices

    Partitioning benefitsCost

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    37/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partition options

    Range

    Hash

    List

    Partitioning optionsClassic

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partitioning optionsComposite partitioning

    Table SALESRANGE(order_date)-RANGE(ship_date)

    Jan 2006

    ... ...

    Feb 2006 Mar 2006 Jan 2007

    ... ...

    ... ...

    ...

    ...

    ...

    ...

    Jan2006

    Feb2006

    Jan2007

    Data ispartitioned alongtwo dimensions(A,B)

    A distinct valuepair for the twodimensionsuniquelydetermines thetarget partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partitioning optionsComposite partitioning

    Table SALESRANGE(order_date)-RANGE(ship_date)

    Jan 2006

    ... ...

    Feb 2006 Mar 2006 Jan 2007

    ... ...

    ... ...

    ...

    ...

    ...

    ...

    Jan2006

    Feb2006

    May2006

    Mar 2006

    All records withorder_date inMarch 2006ANDship_date inMay 2006

    May2006

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    38/118

    Composite partitioning options

    11g11g11gList

    8i9iR211gRange

    HashListRange

    Partitioning optionsComposite partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partitioning optionsInterval partitioning

    Extension to range partitioning

    Full automation for equi-sized range partitions

    Partitions are created automatically as data arrives No need to create new partitions

    Local indexes are created and maintained as well

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Table SALES

    Jan 2006

    ... ...

    Feb 2006 Mar 2006 Jan 2007 Oct 2009 Nov 2009

    ...

    Interval partitioned table can have classical range andautomated interval section Automated new partition management plus full partition

    maintenance capabilities:Best of both worlds

    Partitioning optionsInterval partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Table SALES

    Jan 2006

    ... ...

    Feb 2006 Mar 2006 Jan 2007 Oct 2009 Nov 2009

    ...

    Interval partitioned table can have classical range andautomated interval section Automated new partition management plus full partition

    maintenance capabilities: Best of both worlds

    MERGE and move old partitions for ILM

    Range partition section

    Partitioning optionsInterval partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    39/118

    Table SALES

    Jan 2006 Feb 2006 Mar 2006 Jan 2007 Oct 2009 Nov 2009

    Interval partitioned table can have classical range andautomated interval section Automated new partition management plus full partition

    maintenance capabilities:Best of both worlds

    MERGE and move old partitions for ILM

    Range partition section

    ... ... ...

    Interval partition section

    VALUES ('13-NOV-2009')Insert new data- Automatic segment creation

    Partitioning optionsInterval partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Table SALES

    ...

    2005 Q1 2006 Oct 2006

    Range partitioned tables can be extended into intervalpartitioned tables Simple metadata command

    Investment protection

    Q2 2006

    ...

    Partitioning optionsInterval partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Table SALES

    ...

    2005 Q1 2006 Oct 2006Q2 2006

    ALTER TABLE sales (order_date DATE, ...)SET INTERVAL(NUMTOYMINTERVAL(1,'month');

    Range partitioned tables can be extended into intervalpartitioned tables Simple metadata command

    Investment protection

    ...

    New monthlyInterval partitions

    Old range partition table

    ...

    Partitioning optionsInterval partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Related tables benefit from same partitioning strategy Sample 3NF order entry data model

    Redundant storage of the same information solvesthis problem Data overhead

    Maintenance overhead

    Business Problem

    Solution Oracle Database 11gintroduces REF Partitioning

    Child table inherits the partitioning strategy of parent tablethrough PK-FK relationship

    Intuitive modelling Enhanced performance and manageability

    Partitioning optionsREF partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    40/118

    Table ORDERS

    Jan 2006

    ... ...

    Feb 2006

    Table LINEITEMS

    Jan 2006

    ... ...

    Feb 2006

    RANGE(order_date)

    Primary key order_id

    RANGE(order_date)

    Foreign key order_id

    Redundant storage of order_date

    Redundant maintenance

    Partitioning optionsBefore REF partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Table ORDERS

    Jan 2006

    ... ...

    Feb 2006

    Table LINEITEMS

    Jan 2006

    ... ...

    Feb 2006

    RANGE(order_date)

    Primary key order_id

    RANGE(order_date)

    Foreign key order_id

    RANGE(order_date)

    Foreign key order_id

    PARTITION BY REFERENCE Partitioning key inherited through

    PK-FK relationship

    Partitioning optionsWith REF partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Want to create extended schema attributes are fullyderived and dependent on existing common data

    Redundant storage or extended view definitions aresolving this problem today Requires additional maintenance and creates overhead

    Business Problem

    Solution Oracle Database 11g introduces virtual columns

    Purely virtual, meta-data only

    Treated as real columns except no DML Virtual columns can have statistics

    Virtual columns are eligible as partitioning key Enhanced performance and manageability

    Partitioning optionsVirtual column-based partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    ORDERS

    ORDER_ID ORDER_DATE CUSTOMER_ID...---------- ----------- ----------- --9834-US-14 12-JAN-2007 659208300-EU-97 14-FEB-2007 396543886-EU-02 16-JAN-2007 45292566-US-94 19-JAN-2007 153273699-US-63 02-FEB-2007 18733

    REGION requires no storage

    Partition by ORDER_DATE, REGION

    REGION AS (SUBSTR(ORDER_ID,6,2))------

    USEUEUUSUS

    Partitioning optionsVirtual column-based partitioning

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    41/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Index partitioning

    Created as equi-partition with theunderlying table; created with theLOCAL attribute

    the indexpartition key ranges andtable partition key ranges areidentical

    Managed automatically by server toensure equi-partitioning

    Easier administration

    Enables parallelism of index scans

    Reduction of scheduled downtime

    Only one index partition affectedby maintenance operation on anunderlying table partitionPartition

    Q1

    Partition

    Q2

    Partition

    Q3Partition

    Q4

    SALES07 Table

    IndexPartition

    IndexPartition

    IndexPartition

    IndexPartition

    CREATE INDEX order_idxON sales07 (order_no)

    LOCAL(PARTITION INDEX_Q1,PARTITION INDEX_Q2 ,PARTITION INDEX_Q3,PARTITION INDEX_Q4);

    CREATE INDEX order_idxON sales07 (order_no)

    LOCAL(PARTITION INDEX_Q1,PARTITION INDEX_Q2 ,PARTITION INDEX_Q3,PARTITION INDEX_Q4);

    Local partitioned indexes

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    41

    Not equi-partitioned with theunderlying table

    The index is partitioned by the indexkey, not by the table partition key

    OLTP applications may getbetter performance becausethey minimize the number ofindex probes

    Harder to manage than localindexes

    Can be unique or non-uniquePartitionQ1

    Partition

    Q2

    Partition

    Q3Partition

    Q4

    SALES TablePartitioned by Quarter

    CREATE INDEX product_idxON sales07 (product_id)

    PARTITION BY RANGE(product_id)GLOBAL(PARTITION PIDX1 VALUES LESS THAN (1000),PARTITION PIDX2 VALUES LESS THAN (2000),PARTITION PIDX3 VALUES LESS THAN (MAXVALUE));

    CREATE INDEX product_idxON sales07 (product_id)

    PARTITION BY RANGE(product_id)GLOBAL(PARTITION PIDX1 VALUES LESS THAN (1000),PARTITION PIDX2 VALUES LESS THAN (2000),PARTITION PIDX3 VALUES LESS THAN (MAXVALUE));

    Index PartitionProducts

    0-999

    Index PartitionProducts

    1000-1999

    Index PartitionProducts

    2000 +

    Global partitioned indexes

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    All index data within one schemaobject

    Treated the same as global indexes

    Administration advantages gainedwhen table is partitioned are lost ifassociated indexes are notpartitioned

    Why? If recovering a partition of a table,it will only be usable once the entire non-partitioned Index is recovered and usable

    Non-Partitioned Index

    Partition

    Q1

    Partition

    Q2

    Partition

    Q3Partition

    Q4

    SALES07 Table

    CREATE INDEX sales07_idxON sales97 (sales_date);

    CREATE INDEX sales07_idxON sales97 (sales_date);

    Non-partitioned indexes

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    42/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partition operations

    Partition-wise join

    scan scan

    join

    Sales.prod_id = products.prod_id

    Products Sales

    Scan of both tablesin serial

    Compares (joins) allrows from sales withproducts

    Equi-partitioning oftables will beleveraged

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Partition-wise parallel join

    scan scan

    join

    scan scan

    join

    Sales.prod_id = products.prod_id

    Products Sales

    Scan of both tablesin serial

    Compares (joins) allrecords from saleswith products

    Equi-partitioning oftables will beleveraged

    No data distributionrequired with RAC

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Rolling window operations

    Q106 Q206 Q306 Q406

    Order Table(partitioned by quarter)

    Drop

    Other data & queries not affected

    Q107

    Add

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    43/118

    EXCHANGE PARTITION

    The basic technique of bulk-loading new data into atemporary load table, which is then indexed, analyzed,and then published all at once to end-users using theEXCHANGE PARTITION operation

    Should be the default load technique for all large tables ina data warehouse

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    22-Feb

    2008

    23-Feb

    2008

    24-Feb

    2008

    (empty)

    Composite-partitioned

    table TXN

    2. Bulk

    Loads

    5. EXCHANGE PARTITION

    3. Create

    Indexes

    4. Table

    / Col Stats

    EXCHANGE PARTITION

    1. Create

    Temp Table

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    25-Feb

    2008

    Hash-partitioned

    table TXN_TEMP

    Summary

    Partitioning improves performance andmanageability

    Oracle supports many types of partitioning,including range, list, hash, interval, virtualcolumn and reference partitions

    Oracle supports composite partitions

    Performance goal is partition-wise joins

    Indexes can be local or global

    Partition exchange can be used to add

    data to a warehouse with very highavailability

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    44/118

    For Oracle employees and authorized partners only. Do not distribute to third parties.

    2008 Oracle Corporation Proprietary and ConfidentialFor Oracle employees and authorized partners only. Do not distribute to third parties.

    2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    Title of Presentation

    Presenters NamePresenters Title

    Result Caches

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Module Agenda

    SQL Result Cache

    PL/SQL Function Cache

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    45/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    SQL Result Cache

    Analyze data across large data sets Reporting

    Forecasting & trend analysis

    Data mining

    Use parallel execution for good performance

    Result Very I/O intensive workload direct reads from disk

    Memory is less important

    PGA memory more sensitive based on sort or aggregations

    SQL Result CacheData warehouse workloads

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    SQL Result CacheData warehouse sample query

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Accesses many rows

    Returns few rows

    select p.prod_category, sum(s.amount_sold) revenuefrom products p, sales swhere s.prod_id = p.prod_idand s.time_idbetween to_date('01-JAN-2006','dd-MON-yyyy')and to_date('31-DEC-2006','dd-MON-yyyy')

    group by rollup (p.prod_category)

    SQL Result CacheWhat it does

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Caches results of queries, query blocks, orPL/SQL function calls

    Read consistency is enforced DML/DDL against dependent database objects invalidates

    cache

    Bind variables parameterize cached result withvariable values

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    46/118

    SQL Result CacheHow it works

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Table 1

    Table 2 Table 3

    join

    join

    Group by

    query 1executes

    SQL Result CacheHow it works

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Table 1

    Table 2 Table 3

    join

    join

    Group by

    Table 1

    Table 2 Table 3

    join

    join

    Group bycachedresult

    result iscached

    SQL Result CacheHow it works

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Table 1

    Table 2 Table 3

    join

    join

    Group bycachedresult

    Table 5 Table 6

    join

    Table 4

    join

    Group by

    joinQuery 2 uses cachedresult transparently

    RESULT_CACHE_MODE initialization parameter MANUAL, use hints to populate and use

    FORCE, queries will use cache without hint

    RESULT_CACHE_MAX_SIZE initialization parameter Default is dependent on other memory settings

    (0.25% of MEMORY_TARGET or 0.5% of SGA_TARGETor 1% of SHARED_POOL_SIZE)

    0 disables result cache

    Never > 75% of shared pool (built-in restriction)

    /*+ RESULT_CACHE */ hint in queries

    SQL Result CacheEnabling SQL Result Cache

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    47/118

    SQL Result CacheSQL hint example

    Use RESULT_CACHE hint

    select /*+ RESULT_CACHE */ p.prod_category, sum(s.amount_sold) revenuefrom products p, sales swhere s.prod_id = p.prod_idand s.time_idbetween to_date('01-JAN-2006','dd-MON-yyyy')and to_date('31-DEC-2006','dd-MON-yyyy')

    group by rollup (p.prod_category)

    SQL Result CacheView hint example

    Use RESULT_CACHE hint in view definitionselect prod_subcategory, revenuefrom(select /*+ RESULT_CACHE */ p.prod_category, p.prod_subcategory, sum(s.amount_sold) revenuefrom products p, sales swhere s.prod_id = p.prod_idand s.time_idbetween to_date('01-JAN-2006','dd-MON-yyyy')and to_date('31-DEC-2006','dd-MON-yyyy')

    group by rollup (p.prod_category, p.prod_subcategory))where prod_category = 'Women'/

    Similar query for different prod_category can use cached result

    SQL Result CacheExecution plan for query using result cache

    ------------------------------------------------------------------| Id | Operation | Name |------------------------------------------------------------------| 0 | SELECT STATEMENT | || 1 | RESULT CACHE | fz6cm4jbpcwh48wcyk60m7qypu || 2 | SORT GROUP BY ROLLUP | ||* 3 | HASH JOIN | || 4 | PARTITION RANGE ITERATOR| ||* 5 | TABLE ACCESS FULL | SALES || 6 | VIEW | index$_join$_001 ||* 7 | HASH JOIN | || 8 | INDEX FAST FULL SCAN | PRODUCTS_PK || 9 | INDEX FAST FULL SCAN | PRODUCTS_PROD_CAT_IX |------------------------------------------------------------------

    Depends... based on Query repetitiveness

    Query execution times

    DML activity (cache invalidation frequency)

    Remember data warehouse workload Query may run 30 minutes

    Query may return 5 rows

    Query served from result cache would take a split second

    SQL Result CacheOpportunity for benefit

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    48/118

    Use DBMS_RESULT_CACHE package to manage

    Use V$RESULT_CACHE_* views to monitor

    SQL Result CacheManagement

    Result cache is disabled for queries containing Temporary or dictionary tables

    Non-deterministic PL/SQL functions

    Sequence CURRVAL and NEXTVAL

    SQL functions current_date, sysdate, sys_guid, etc.

    Result cache for distributed queries Set RESULT_CACHE_REMOTE_EXPIRATION > 0

    0 means distributed queries are not cached

    Default is 0

    DML/DDL on remote database will not expire cached results

    SQL Result CacheRestrictions

    Result cache does not automatically release memory Grows until maximum size is reached

    DBMS_RESULT_CACHE.FLUSH purges memory

    Bind variables Cached result is parameterized with variable values

    Cached results can only be found for same variable values

    Cached result will not be built if Query is built on a non-current version of data (read consistency

    enforcement)

    Current session has outstanding transaction on table(s) in query

    Flashback queries can be cached

    SQL Result CacheCaveats

    Retail customer data (~50 GB)

    Concurrent users submitting queries randomly Executive dashboard application with 12 heavy analytical queries

    Cache results only at in-line view level 12 queries run in random, different order

    4 queries benefiting from the cache

    Measure average, total response time for all users

    # Users No cache Cache Im provem ent

    2 186 s 141 s 24%

    4 267 s 201 s 25%

    8 447 s 334 s 25%

    SQL Result CacheInternal benchmark

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    49/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    PL/SQL Function Cache

    Calculate a complex derived metric like the ratio ofthe highest median income grouped by state to thelowest median income grouped by state over thewhole population

    You need a PL/SQL function

    Like the results stored in the SQL Result Cache, thedata changes fairly slowly but the query is repeatedfairly often

    PL/SQL Function CacheThe challenge

    function f2 return t1%rowtype

    is...

    beginselect a, m into r1.a, r1.b from ...;

    select a, m into r2.a, r2.b from ...;

    r.a := r1.a + r2.a;r.b := r1.b + r2.b;return r;

    end f2;

    ~ 2,000 milliseconds for each new call

    PL/SQL Function CacheFunction implementation

    function f2 return t1%rowtyperesult_cache relies_on(t1, t2)

    is...

    beginselect a, m into r1.a, r1.b from t1;

    select a, m into r2.a, r2.b from t2;

    r.a := r1.a + r2.a;r.b := r1.b + r2.b;return r;

    end f2;

    ~ 0 milliseconds for each new call

    PL/SQL Function CacheUsing the function cache

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    50/118

    Both are cross-session and RAC interoperable Set RESULT_CACHE_MAX_SIZE > 0 on all instances, or = 0

    on all instances

    Memory pool is instance-specific

    Both build on the same infrastructure Same RESULT_CACHE_MAX_SIZE initialization parameters

    Same DBMS_RESULT_CACHE management package

    Same V$RESULT_CACHE_*performance views

    PL/SQL Function CacheSimilarities with SQL Result Cache

    Summary

    The Result Cache saves results of queries,reducing overhead needed on repeateduse

    Result cache is invalidated if there is DMLor DDL on cached tables

    Result Cache can be used to satisfy part ofa query

    PL/SQL Function Cache can cachefunction results

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties.

    2008 Oracle Corporation Proprietary and Confidential

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    51/118

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2008 Oracle Corporation Proprietary and Confidential

    Title of Presentation

    Presenters NamePresenters Title

    Oracle OLAP

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Module Agenda

    Oracle OLAP Option

    Cube Organized Materialized Views

    Querying OLAP Cubes

    For Oracle employees and authorized partners only. Do not distribute to third parties. 2009 Oracle Corporation Proprietary and Confidential

    Oracle OLAP Option

  • 5/22/2018 DW Implementation Boot Camp - Student Manual

    52/118

    A full featured multidimensional OLAPserver

    Excellent query performance for ad-hoc /unpredictable query

    Enhances the analytic content of businessintelligence application

    Fast