51
T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com Mark Rittman, Director, Rittman Mead ODTUG Kaleidoscope 2010, Washington D.C. Inside the Oracle BI Server (10g)

Inside OBIEE 10g Server

Embed Size (px)

DESCRIPTION

Inside OBIEE 10g Server - The inner workings

Citation preview

Page 1: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Mark Rittman, Director, Rittman MeadODTUG Kaleidoscope 2010, Washington D.C.

Inside the Oracle BI Server (10g)

Page 2: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Introductions

• Oracle BI&W Architecture and Development Specialist• Co-Founder of Rittman Mead Consulting

‣ Oracle BI&W Project Delivery Specialists• 10+ years with Discoverer, OWB etc• Oracle ACE Director, ACE of the Year 2005• Writer for OTN and Oracle Magazine• Longest-running Oracle blog

‣ http://www.rittmanmead.com/blog• Ex-Chair of UKOUG BIRT SIG• ODTUG Director• Editor of Oracle Scene• Co-Chair of ODTUG BI&DW SIG• Speaker at IOUG and BIWA events• Ex-member of the Blue Man Group *

* Not technically true

Page 3: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Inside the Oracle BI Server

• In this session, we will look in-depth at the Oracle BI EE Oracle BI Server• What components are in the BI Server• What is the Navigator, and how does it

turn incoming logical requests into optimized physical SQL and MDX

• What happens when it processes a query• What happens when the BI Server joins

resultsets in memory• And what influences SQL generation, join

strategy and BI Server resource usage

Page 4: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Why Is This Topic Important?

• Now this could be a pretty boring topic• But its one of the most important parts of the BI EE technology stack• It provides all of these key features

‣ Query Federation‣ Heterogeneous Connectivity‣ The Semantic Model‣ Aggregate Navigation‣ Time Travel (sort of)

• So what really happens when Answers fires off a query, and the BI Server goes and gets the data...?

Page 5: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

The Oracle BI EE 10g Server Architecture

Page 6: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

The Oracle BI Server 10g Architecture

• Logical SQL interface via ODBC and JDBC• Intelligent Request Generator, made up of

‣ Logical request generator‣ Navigator‣ Optimized Query Rewrites‣ Execution Engine‣ Cache Services

• Other services include ‣ Load balancing (in conjunction with

cluster controller)‣ Query governance‣ Session Management‣ System / Perf Monitoring (JMX etc)

Page 7: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Intelligent Request Generation and the BI Server Navigator

• The Navigator is the key component that parses incoming requests and generates the relevant physical SQL and MDX queries

• Invoked if cache cannot be used• Handles the following translations

‣ Function push-down‣ Multi-pass logic (time series etc)‣ Aggregate navigation‣ Fragmentation navigation

• Responsible for generating optimized SQL and MDX for the mapped data sources

• Uses rules and definitions present in the RPD

Page 8: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

• The BI Server tries to push functions and joins down to the underlying databases• Where not possible, the BI Server will functionally compensate by calculation,

joining data sources in memory

Parse Incoming Logical SQL

Generate Optimized Physical SQL(s)

Receiving Incoming Resultsets

Apply any required functions and joins

Return data to user

The BI Server Functional Compensation Model

Page 9: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

How Does The BI Server Process Queries?

• So what happens when the BI Server processes an incoming query?• What are the steps involved in translating logical requests to physical queries?• What does the Navigator do?• What rules and statistics does it use?• How can we influence the physical queries that it generates?• How can we tell what is going on?

Page 10: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 1 : Request Arrives at Intelligent Request Generator

• Query arrives from Answers or other ODBC tool, against Semantic Model• Passed to Intelligent Request Generation function

Page 11: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 2 : Request Passed to Logical Request Generation Engine

• Request passed to Logical Request Generation engine, responsible for generating the one or more logical SQL required to satisfy the query

• In this case, request requires multiple columns and a derivation (calculation)

Page 12: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 3 : Check Cache if Enabled

• If caching is enabled, Cache Services is checked for the result• Avoids calls to physical databases for frequently-requested data• Intelligent checking of cache including derivation, projection, nested formulas etc

Page 13: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Rules for a Cache Hit

• Caching is enabled (CACHE=Y in the NQSConfig.INI file);• WHERE clause is semantically the same

or a logical subset of a cached statement;• All of the columns have either to be present

or derivable from cached copies• It has equivalent join conditions• If DISTINCT is used, the cached copy has to

use this attribute as well• Aggregation levels have to be compatible,

being either the same or more aggregated than the cached query

• No further aggregation (for example, RANK) can be used in the incoming query

• Compatible ORDER BY clause

Page 14: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 4 : Request Passed to the Navigator

• Navigator is responsible for navigating the semantic model and generating the execution plan, and most optimal physical SQLs, for the request

• Contains multiple functions that are used dependent on the nature of the request

Page 15: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 5 : Multi-Pass / Sub-Request Logic

• Analyzes request and works out the complexity of the query• Determines whether multi-pass logic is required (time-series etc)• Works out whether one request depends on the results of another (sub-request)• Navigator uses this

function to determine the most efficient way to satisfy the request

Page 16: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 6 : Fragment Optimization

• When a measure is fragmented, the Fragment Optimization function will transform base-level logical SQL into logical SQL fragments

• Also automatically resolves fan-trap issues

Page 17: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 7 : Aggregate Navigation

• Aggregate Navigation checks aggregates mapped in RPD for relevance• Execution Plan will be written to use aggregates if they return less rows than

the default logical table sources

Page 18: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 8 : Optimized Query Rewrite, and pass to Execution Engine

• Optimized Query Rewrite checks database capabilities for function shipping and ability to join subqueries

• Generates optimal physical SQL or MDX for relevant data sources• Passed to Execution

Engine for transfer to physical databases

Page 19: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Step 9 : Copy Back to Cache Services, if Enabled

• Results are returned to calling application (Answers etc)• If caching is enabled, results are copied back to Cache Services

Page 20: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Key Navigator Functionality

• BI Server will pick one or more LTSs at run-time based on query context• Generates an execution plan• Will try and generate as few physical SQL as possible• Will try to push down functions if possible• Will try to push down joins if possible• Will write the optimal SQL or MDX for the

data source, based on DBFunctions.INI matrix

Page 21: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Level 5 Query Logging and Logical Execution Plans

• The execution plan generated by the Navigator can be viewed when Level 5 logging is enabled

• Shows the execution plan, step-by-step row counts, and the physical SQL / MDX generated for the request

Page 22: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

BI Server Joins

• (Almost) Every request requires joins• For simple queries, you don’t notice this because they are pushed down to the DB• For more complex queries, the BI Server may need to get involved

‣ Where more than one physical database provides data for the request‣ Where multi-pass logic is used‣ Where measures are fragmented‣ Where more than one fact table is used in the request

• Basic principle is that the BI Server tries to push down all joins• Depending on the database type and version and nature of request,

the BI Server may need to perform the joins instead

Page 23: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

The BI Server Source-to-Target Metadata Model

• Facts and dimensions are mapped to physical sources Logical Table Sources• LTS are chosen at run time based on RPD

definitions (level mapping, fragmentation, federation etc)

Page 24: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

So What Does The BI Server Do, When It Joins Data In Memory?

• So just what goes on when the BI Server joins data in memory?• How can we tell when the BI Server has performed the join?• Why does the BI Server sometimes do the join, and sometimes get the database

to do it instead?

Page 25: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

BI Server Join Type 1 : Fact + Dimension from Single Database

• Single logical fact and dimension table, joined by a logical join• Both logical tables have single LTS, which both point to tables in the

same physical database• Physical tables are joined using a physical foreign key

Sales Logical

Fact

Products Logical

Dimension

Products Physical

Table Sales Physical

Table

LTS Mapping

LTS Mapping

Single Database

Page 26: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Single Source Fact and Dimension Execution Plan & SQL

• BI Server generates execution plan with single logical SQL including join clause

• Single physical SQL with join pushed down to database

RqList <<2105>> [for database 3023:2820:orcl3,44]PRODUCTS.PROD_SUBCATEGORY_DESC as c1 GB [for database 3023:2820,44],sum(SALES.QUANTITY_SOLD by [ PRODUCTS.PROD_SUBCATEGORY_DESC] ) as c2 G

B [for database 3023:2820,44]

Child Nodes (RqJoinSpec): <<2136>> [for database 3023:2820:orcl3,44]PR

O

D

U

CTS T2874

SALES T2911DetailFilter: PRODUCTS.PROD_ID = SALES.PROD_ID [for database 0:0]GroupBy: [ PRODUCTS.PROD_SUBCATEGORY_DESC] [for database 3023:2820,44]OrderBy: c1 asc [for database 3023:2820,44]

select T2874.PROD_SUBCATEGORY as c1, sum(T2911.QUANTITY_SOLD) as c2from PRODUCTS T2874, SALES T2911

w here ( T2874.PR

O

D_ID = T2911.PR

O

D_ID ) group by T2874.PROD_SUBCATEGORYorder by c1

Page 27: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

BI Server Join Type 2 : Fact + Dimension from Two Databases

• Single logical fact and dimension table, joined by a logical join• Both logical tables have single LTS, which point to different databases• Physical tables are joined using a

physical foreign key

Sales Logical

Fact

Products Logical

Dimension

Products Physical

Table

Sales Physical

Table

LTS Mapping

LTS Mapping

Database #1

Database #2

Page 28: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Multiple Source Fact and Dimension Execution Plan

• Excerpt of plan (source rqList cropped)• Two logical SQL blocks with InnerJoin between fact and dimension tables

‣ Can also be LeftOuterJoin, RightOuterJoin and FullOuterJoin(RqList <<2495>> [for database 3023:132:orcl,44]SALES.PROD_ID as c2 [for database 3023:132,44],sum(SALES.QUANTITY_SOLD by [ SALES.PROD_ID] ) as c3 [for database 3023:132,44]Child Nodes (RqJoinSpec): <<2504>> [for database 3023:132:orcl,44]SALES T211GroupBy: [ SALES.PROD_ID] [for database 3023:132,44]OrderBy: c2 asc [for database 3023:132,44]) as D901InnerJoin <<2492>> O

n D901.c2 = D902.c2; actual join vectors: [0 ] = [ 1 ]

(RqList <<2517>> [for database 3023:2500:orcl2,44]PRODUCTS.PROD_SUBCATEGORY_DESC as c1 GB [for database 3023:2500,44],PRODUCTS.PROD_ID as c2 [for database 3023:2500,44]Child Nodes (RqJoinSpec): <<2523>> [for database 3023:2500:orcl2,44]PR

O

D

U

CTS T2502

OrderBy: c2 asc [for database 3023:2500,44]) as D902OrderBy: c2, c3 [for database 0:0,0] ) as D1OrderBy: c1 asc [for database 0:0,0]

Page 29: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Multiple Source Fact and Dimension Physical SQL

• Two physical SQL queries sent to the two databases• BI Server joins the two sources in-memory using a sort-merge join algorithm

-------------------- Sending query to database named orcl (id: <<6057>>):select T211.PROD

ID as c2, su

m(T211.Q

U A N TIT

Y S O L D) as c3fro

m

Sending query to datab as

e na

m e d orcl2 (id: <<6074>>):select T2502.PROD_SUBCATEGORY as c1, T2502.P

R

O

D_ID as c2from PRODUC

Page 30: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

BI Server Join Type 3 : Fact + Dimension Using Driving Table

• Single logical fact and dimension table, joined by a logical join• Two tables typically LTS mapped to different physical databases• One of the logical tables defined as a driving table in the BMM logical join• Driving table uses Parameterized Nested

Loop Join (PNLJ) to “probe” other table

Sales Logical

Fact

Products Logical

Dimension

Products Physical

Table

Sales Physical

Table

LTS Mapping

LTS Mapping

Database #1

Database #2

PNLJ Probe Lookup

Page 31: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Driving Table Considerations

• By default, federated queries will cause both tables to be loaded into the BI Server memory, and then joined (as per previous example)

• Can be expensive if one or more of the tables are large• An alternative is to designate one of the tables as

the “driving table”‣ Needs to be small, typically <1000 rows

• This table is then queried and filtered first, then it’s remaining rows are then applied as a filter to the second table

• Driving table is defined in the Logical Join dialog

Page 32: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Parameterized Nested Loop Join Algorithm & Physical SQL

1. Start reading rows from the driving table2. Submit a parameterized query request to non-driving table3. Bind values from the drive-table rows into the parameterized query and fetch results4. Repeat until all rows from drive table are processed RqList PRODUCTS.PROD_SUBCATEGORY as c1 GB, QUANTITY_SOLD:[DAggr(SALES.QUANTITY

SOLD by [ PRODUCTS.PROD

SUB

select T2502.PROD_SUBCATEGORY as c1, T2502.PR O

D_ID as c2from

PRODUCTS T2502order by c2

select T211.PROD_ID as c2, sum(T211.QUANTITY_SOLD) as c3from SALES T211where ( T211.PROD_ID in (:PA

R A M 1, :PA

R

A

M

2, :PA

R A M 3,

:PARAM4, :PARAM5, :PARAM6, :PARAM7, :PARAM8, :PARAM9, :PARAM10,

:PA R A M 11, :PARAM12, :PARAM13, :PARAM14, :PA

R A M 15, :PAR

A M 16,

:PA R A M 17, :PARAM18, :PARAM19, :PARAM20) ) group by T211.P

R

O

D_ID

order by c2

Page 33: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Fact and Dimension Driving Table Execution Plan

• Excerpt of plan• Note InnerJoin (left drive) and parameterized DetailFilter in plan( RqList <<13655>> [for database 3023:2500:orcl2,44] PRODUCTS.PROD_SUBCATEGORY

as c1 GB [for database

3023:2500,44], PRODUCTS.PROD_ID as c2[for database 3023:2500,44] Child Nodes (RqJoin S p ec): <<13658>> [for

database 3023:2500:orcl2,44] PRODUCTS T2502 OrderBy: c2 asc [for database 3023:2500,44] ) as D901

InnerJoin (left drive) <<13689>> On D902.c2 = D901.c2; actual join vectors: [ 1 ]=[ 0 ] ( RqList <<13673>> [for database

3023:132:orcl,46] SA L E S.P

R O D _ID as c2

[for database 3023:132,46], su

m(S

AL

E S.Q

U A N TITY_S

O L D by [

SALES.PROD_ID] ) as c3 [for database 3023:132,46] Child Nodes (RqJoin S p ec): <<13676>> [for database 3023:132:orcl,46]

SALES T211 DetailFilter: S A L E S.P

R O D _ID = ?1 or S

A L E S.P

R O D _ID = ?2 or S

A L E S.

P R O D _I

D = ?3 or

S A L E S.PRO

D_ID = ?4 or SALE

S.PR

O

D_ID = ?5 or SALE

S .PR

O D_ID = ?6 or SALE

S.PR

O D_ID = ?7 or SA

L

E

S.PR

O

D_ID = ?8

or SALE S.PR

O D_ID = ?9 or SALE

S

.PR

O

D_ID = ?10 or SALE

S.PR

O D_ID = ?11 or S

A L E S.PRO

D_ID = ?12

or SALES.PROD_ID = ?13 or SALES.PROD_ID = ?14 or SA L E S.P

R O D _ID =

?15 or S

A L E S.PR

O D _ID = ?16

or SALES.PROD_ID = ?17 or SALES.PROD_ID = ?18 or SALES.PR O

D_ID =

?19 or SALES.PR

O

D_ID = ?20 [for database 0:0]

GroupBy: [ SALES.PROD_ID] [for database 3023:132,46] OrderBy: c2 asc [for database 3023:132,46] ) as D 902

Page 34: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

BI Server Join Type 4 : Two Facts Using a Single Database

• Query requires data from two fact tables, sharing a common dimension• BI Server creates two logical queries and “stitches” results together, to avoid “fan trap”• Join is pushed down to the database if possible

Sales Logical

Fact

Products Logical

Dimension

Costs Logical

Fact

Single Database

Sales Physical

Table

Products Physical

Table

Costs Physical

Table

LTS Mapping

LTS Mapping

LTS Mapping

Page 35: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Facts with Conformed Dimensions Execution Plan

• Two result sets are generated, with a FullOuterStitchJoin between them• Capabilities of physical database determine whether join is pushed down to database(

RqList <<3474>> [for data b a s e 3

0 2 3:2

8 2 0:orcl3,46]

sum(COSTS.UNIT_COST by [ PRODUCTS.PROD_SUBCATEGORY_DESC] ) as c1 GB [for database 3023:2820,46],PRODUCTS.PROD_SUBCATEGORY_DESC as c2 GB [for database 3023:2820,46]

Child Nodes (RqJoinSpec): <<3507>> [for database 3023:2820:orcl3,46]PR

O D U C T S T2874

C OSTS T2830

D etailFilter: COSTS.PROD_ID = PRODUCTS.PROD_ID [for database 0:0]GroupBy: [ PRODUCTS.PROD_SUBCATEGORY_DESC] [for database 3023:2820,46]

) as D1 FullOuterStitchJoin <<3565>> On D1.c2 = D2.c2(

RqList <<3511>> [for data b a s e 3

0 2 3:2

8 2 0:orcl3,46]

sum(SALES.AMOUNT_SOLD by [ PRODUCTS.PROD_SUBCATEGORY_DESC] ) as c1 G B [for database 3023:2820,46],

PRODUCTS.PROD_SUBCATEGORY_DESC as c2 GB [for database 3023:2820,46]Child Nodes (RqJoinSpec): <<3544>> [for database 3023:2820:orcl3,46]PR

O D U C T S T2874

SALES T2911D etailFilter: PRODUCTS.PROD_ID = SALES.PROD_ID [for database 0:0]GroupBy: [ PRODUCTS.PROD_SUBCATEGORY_DESC] [for database 3023:2820,46]

) as D2

Page 36: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Facts with Conformed Dimensions Single Physical SQL

• Where database supports subquery factoring (Oracle 10gR2+) a single physical SQL will be generated with a full outer join between all shared dimension columns

WITHSA WITH0 AS (select sum(T2830.UNIT_COST) as c1,

T2874.PROD_SUBCATEGORY_DESC as c2fro

mPRODUCTS T2874,COSTS T2830

where ( T2830.PR O

D

_ID = T2874.PR

O

D_ID )

group by T2874.PROD_SUBCATEGORY_DESC),SA WITH1 AS (select sum(T2911.AMOUNT_SOLD) as c1,

T2874.PROD_SUBCATEGORY_DESC as c2fro

mPRODUCTS T2874,SALES T2911

where ( T2874.PR O

D

_ID = T2911.PR

O

D_ID )

group by T2874.PROD_SUBCATEGORY_DESC)select distinct SA

WITH0.c1 as c1,

SA WITH

1.c1 as c2,

case when SA WITH0.c2 is not null then S

A WI

T H 0.c2

when SA WITH1.c2 is not null then SA

WITH1.c2 end as c3

fro mSA

WITH0 full outer join SAWITH1 On SA

WITH0.c2 = SA WITH1.c2

order by c3

Page 37: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Facts with Conformed Dimensions Multiple Physical SQL

• Otherwise, multiple physical SQL queries will be generated• BI Server will perform in-memory sort-merge stitch full outer join on shared dim columns--------------------

Sending query to database named orcl3 (id: <<3018>>):

select su m(T2830.UNIT_C

O S T) as c1,

T2874.PROD_SUBCATEGORY_DESC as c2fro

mPRODUCTS T2874,COSTS T2830

where ( T2830.PR O

D

_ID = T2874.PR

O

D_ID )

group by T2874.PROD_SUBCATEGORY_DESC order by c2

+ + + A d mi

nistrator:2a0000:2a0005:----2010/02/28 15:05:31

-------------------- Sending query to database named orcl3 (id: <<3055>>):

select su m(T2911.A

M O U N T_

S O L D) as c1,

T2874.PROD_SUBCATEGORY_DESC as c2fro

mPRODUCTS T2874,SALES T2911

where ( T2874.PR O

D

_ID = T2911.PR

O

D_ID )

group by T2874.PROD_SUBCATEGORY_DESC order by c2

Page 38: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Stitch Joins and Federated Queries

• Stitch joins are used whenever multiple fact tables are used in queries• Also used when federated fact table sources are used, and aggregate sources• Basic principle is to join facts using FullOuterStitchJoin

across all dimension attribute columns used in the query

...) as D901 FullOuterStitchJoin <<7800>> On D901.ProductCategory =NullsEqual D902.Pro

d uctCateg

ory

and D901.ProductCategory =NullsEqual D902.Pro d uctCateg

ory;

actual join vectors: [ 0 1 ] = [ 0 1 ](...

Page 39: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Rules for BI Server Join Strategy

• Try to generate as few physical SQL / MDX queries as possible• Push as many joins (and functions) down to the database as possible• Where required, join fact and dimensions in memory using inner and outer sort-merge joins• If driving table is specified, iterate through join using nested loop algorithm• Generate one logical SQL query per fact table access,

push down stitch join to database using full outer join if possible, if not have the BI Server do it

• Logical execution plan and resulting physical SQLs visible in the Level 5 log file

Page 40: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

BI Server Join Variations 1 : Fragmentation (Partitioned Measures)

• RPD has a measure mapped through two or more LTS to different physical tables• One physical source for historic data, one for real-time• One for Southern Region, one for Northern Region• Known as fragmentation• BI Server has to UNION the resultsets

together

Page 41: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Fragmentation (Partitioned Measures) Logical Execution Plan

• Execution Plan will contain two logical SQL blocks (excerpt shown below)• RqUnion All union’s the two resultsets, BI Server will attempt to push down to database

if possible (if not, two physical SQLs will need to be retrieved and UNION done in memory)

(RqList <<7613>> [for database 3023:6594:orcl7,44]PRODUCTS.PROD_SUBCATEGORY_DESC as c2 [for datab

as

e 30

2 3:6

5 9 4,44],

SALES_UPTO_2003.AMOUNT_SOLD as c3 [for database 3023:6594,44]Child Nodes (RqJoinSpec): <<7617>> [for database 3023:6594:orcl7,44]PRODUCTS T6596SALES T6629

DetailFilter: PRODUCTS.PROD_ID = SALES_UPTO_2003.PROD_ID [for database 0:0]RqUnion All <<7690>> [for database 3023:6594:orcl7,44]RqList <<7668>> [for database 3023:6594:orcl7,44]PRODUCTS.PROD_SUBCATEGORY_DESC as c2 [for datab

as

e 30

2 3:6

5 9 4,44],

SALES_BEYOND_2003.AM OUNT_SOLD as c3 [for database 3023:6594,44]Child Nodes (RqJoinSpec): <<7672>> [for database 3023:6594:orcl7,44]PRODUCTS T6596SALES T6637

DetailFilter: PRODUCTS.PROD_ID = SALES_BEYOND_2003.PROD_ID [for database 0:0]) as D3

Page 42: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

BI Server Join Variations 2 : Time-Series Queries

• Generated when time-series functions are used in a request• Requires time dimension to be defined in RPD• Currently limited to AGO and TODATE functions• Generates two or more logical SQL queries which need to be joined together to return time-

series results

Page 43: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 E : [email protected] W: www.rittmanmead.com

Time Series Logical Execution Plan

• Execution plan will show multiple nested logical SQL blocks• More complex set of nested blocks will be doing the time offset• Time offset block will need to be FullOuterStitchJoined to the present-day resultset• Excerpt shown below

• Depending on DB capabilities, will either be shipped as one SQL (using subqueries) or as two or more SQLs (with results full outer stitch joined in memory)

... DetailFilter: IT

E M S.

O R DID = O

R D E R S .O

R DI

D an

d O

R D E R S.

O R D E R D A T E = D

4.c2

an d D

3.c1 = D

4.c

1 an

d D

3 .c2 = 'May-2007' [for database 0:0] GroupBy: [ D3.c2, D3.c3] [for database

3023:4210,44] ) as D1

OrderBy: c1 asc [for database 3023:4210,44] ) as D901 FullOuterStitchJoin <<4892>>

On D901.c1 =Nulls E q u al D902.c1; actual join vectors: [ 0 ] = [ 0 ] (

RqList <<4963>> [for database 3023:4210:orcl4,44] D2.c2 as c1 [for database 3023:4210,44], D2.c1 as c2 GB [for database 3023:4210,44], D2.c3 as c3 [for database 3023:4210,44]

...

Page 44: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Memory and Disk Usage During BI Server Joins

• So what happens when the BI Server performs an in-memory join?• The BI Server requires memory to join the data sets using a sort-merge algorithm• Initial memory usage is determed by size/complexity of the RPD• Memory usage then rises with # of concurrent

sessions, in-memory joins, aggregations • Typically paged to file at {ORACLEBIDATA}/tmp

• Because of paging, use of BI Server functional compensation is largely I/O intensive rather than memory intensive

• Extent of paging driven by VIRTUAL_TABLE_PAGE_SIZE parameter‣ May benefit from increase on Unix systems‣ Docs do not imply much benefit though

Page 45: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

So What Influences Execution Plans and Physical Query(ies)?

• Logical Execution Plan largely determined by the LTS mappings in the RPD• BI Server Navigator generates execution plan based on context of the request

and the LTS configuration in the BMM layer• All can be determined by looking at the RPD

‣ No equivalent to the Oracle database CBO• Physical SQL then determined by

execution plan and DBFeatures.INI

Page 46: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Are There The Equivalent of Object Statistics in the RPD?

• There are some limited statistics in the RPD that influence the query plan‣ Row counts on physical tables are ignored

• Number of Elements at this Level value can be used by the Navigator to determine which of several aggregates to use for a request

• Needs to be manually populated (rough figure is OK)

Page 47: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Dimension Level Element Counts In Use

• Consider the following dimension‣ Time Dim -> Year (2), Month (24), Days (730)‣ Products Dim-> Type (10), Sub-Type (20), SKUs (1000)‣ Customers Dim-> Regions(20), Districts(500), Customers (100000)

• Sales Fact joins to these dimensions at the lowest level.• Also assume I have a couple of aggregate tables :

‣ Sales Fact Agg1 -> (Time Dim)Year, (Customer Dim) Districts‣ Sales Fact Agg2 -> (Time Dim)Year, (Product Dim) Sub-Type

• Consider this Query Example :• Select Year, Sum(Revenue) from Sales ;• This can be satisfied by either Agg1 or Agg2, but BI Server has no way of

knowing which is the best option unless the number of elements are entered.

Page 48: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

What Does the Logical Execution Plan Tell Us?

• It tells us how the BI Server Navigator turned the logical request into physical SQL and MDX queries

• But there’s nothing that you couldn’t infer from the RPD• There are no parameters etc that you can use to alter join strategies etc

‣ This is driven by the repository design only• Extra information provided by Level 7 logging is interesting

‣ Times logged by each entry/step‣ Tells us how long the BI Server

takes to do each join• Can be used to fine-tune the

VIRTUAL_TABLE_POOL_SIZE parameter

Page 49: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

So What Does This All Tell Us?

• Co-locate data as much as possible, minimize in-memory joins• Make sure the database version and capabilities is set correctly for each source• Maximize function push-down, mimimize functional compensation• Understand what happens with BI Server joins, and how to read the execution

plan• Understand what a FullOuterStitchJoin is, and how to avoid unneccesary ones• Understand the role of LTSs and when to add or remove them• There is some diagnostic data available for the BI Server, but most of what

you need is contained in the RPD design

Page 50: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Thank You for Listening

• More details on this topic, and on OBIEE in general, can be found on our blog‣ http://ww w.rittmanmead.com/2010/02/25/inside-the-oracle-bi-server-part-1-the-bi-server- architecture/

‣ http://ww w.rittmanmead.com/2010/03/01/inside-the-oracle-bi-server-part-2-ho w-is-a-query- processed/

‣ http://ww w.rittmanmead.com/2010/03/03/inside-the-oracle-bi-server-part-3-bi-server-in-memory- joins/

• Thank you for your time• Any questions :

‣ Web : http://www.rittmanmead.com‣ Email : [email protected]‣ Twitter : @markrittman

Page 51: Inside OBIEE 10g Server

T : +44 (0) 8446 697 995 or (888) 631 1410 (USA) E : [email protected] W: www.rittmanmead.com

Mark Rittman, Director, Rittman MeadODTUG Kaleidoscope 2010, Washington D.C.

Inside the Oracle BI Server (10g)