Optimizing Oracle Essbase Formulas -...
Transcript of Optimizing Oracle Essbase Formulas -...
![Page 1: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/1.jpg)
![Page 2: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/2.jpg)
Optimizing Oracle Essbase Formulas &
Calc Scripts
NOTE: Slides will not be distributed.
Edward Roske
BLOG: LookSmarter.blogspot.com
WEBSITE: www.interrel.com
TWITTER: Eroske
![Page 3: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/3.jpg)
About interRel
• Reigning Oracle Award winner
EPM & BI Solution of the year
• Three Oracle ACE Directors for
Hyperion
• Oracle Platinum Partner
• One of the 100 fastest growing
tech companies in the USA
(CRN Magazine, 2007-2010)
• Authors of the 8 Best Selling
books on Hyperion & Essbase
• Essbase Studio book to be
released April 11, 2011
• All available on LuLu.com
3
Consulting
Training
Support Infra
structure
Press
Focused exclusively on Oracle EPM & BI
![Page 4: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/4.jpg)
• 8 Hyperion Books Available:
• Essbase (7): Complete Guide
• Essbase System 9: Complete Guide
• Essbase System 9: End User Guide
• Essbase 11: Admin Guide
• Essbase Studio 11 (April 11, 2011)
• Smart View 11: End User Guide
• Planning: End Users Guide
• Planning: Administrators
• To order, check out www.LuLu.com
•Copyright © 2007, Hyperion. All rights reserved. •4
![Page 5: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/5.jpg)
5
Disclaimer
These slides represent the work and opinions of
the presenter and do not constitute official
positions of Oracle or any other organization.
These material has not been peer reviewed and is
presented here with the permission of the
presenter.
These should not be copied, recorded or
reproduced without the expressed written
permission of interRel Consulting.
![Page 6: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/6.jpg)
Keep in Mind: Tuning
• There isn’t one right answer
• Some of the tuning guidelines can contradict other tuning
guidelines
• Have your priorities in order
• BSO is traditionally tuned for calc time then retrieval time
• ASO is traditionally tuned for load time then retrieval time
• The tuning information provided in this chapter is meant to
help you in the development of your applications
• In some databases, these tuning tips will have significant
impact
• In other databases, the tuning tips won’t
• And remember there’s a difference between 32-bit and 64-bit
• Test, test, test!!
![Page 7: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/7.jpg)
Design & Optimize Calculations
Understanding Essbase Consolidations
![Page 8: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/8.jpg)
Calculation Overview
• Outline consolidation
• Calculations that aggregate and roll-up data based on the
hierarchical relationships of the outline
• Relationships that include computed members defined by
formulas
• The use of unary operators in the outline
• + - % / * ~ ^
• FASTEST METHOD OF CALCULATION
• Custom calculation
• Requires a calculation script
• Overrides outline consolidation
![Page 9: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/9.jpg)
Default Calculation
• Simplest method
• Default consolidations
• Formulas as they appear in outline
• Default calculation consists of three steps:
• Data view before the calculation
• Run of default calculation
• Data view after calculation
• A default calc can be changed and it will run faster than a
calc script not set as the default
![Page 10: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/10.jpg)
Dynamic Calculations
• Dynamic calc members are evaluated during retrievals
• You can reference dynamic calc members in a script or
formula
• Watch out for dynamic calc members on different
dimensions
• Sparse will calculate before dense
• Within Dense, it’s outline order
• Two-Pass is last (sparse before dense)
• Watch out for dynamic calcs that are dependent on other
dynamic calcs
![Page 11: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/11.jpg)
Dynamic Calculations
• Tags within Outline Editor
• Calculation upon retrieval
• Reduction of batch calculation time and disk storage
![Page 12: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/12.jpg)
Dynamic Calculations Considerations
• Batch load
• Calculation windows
• Disk space
• Retrieval speed
![Page 13: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/13.jpg)
Dynamic Calculations
Advantages - Dynamic Calc and Store
• 99.999% of the time, don’t use Dynamic Calc and Store
• They fragment your database dramatically
![Page 14: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/14.jpg)
Dynamic Calculations
Advantages - Dynamic Calc (Non-Store)
• Use:
• No impact on pre-calculation window
• Used to retrieve infrequently accessed information or to
save space
• Used when data changes often and changes need to be
reflected instantly
• Reduce block size (for dynamic calcs on dense
dimensions)
• Best Choice for:
• Relatively simple calculations
• Small queries that do not span large numbers of data
cells
• Infrequently accessed data
![Page 15: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/15.jpg)
Setting Dynamic Calc Members
• Both dense and sparse members tagged as
Dynamic Calc
• Consolidated members or members with a formula
• Parents of Dynamic Calc members real or Dynamic
Calc
• Members which cannot be tagged as Dynamic
Calc:
• No level zero (0) members without formulas
• No label-only
• Shared members
• In a single parent-to-child case
![Page 16: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/16.jpg)
Workshop
• You have an outline with the following dimensions:
• Accounts – dense
• Periods – dense
• Scenario – sparse
• Organization – sparse
• You want to add a variance to the Scenario dimension to
calculate Actual vs. Budget
• What storage option should Variance be?
![Page 17: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/17.jpg)
Workshop
• Given the dense and sparse settings from the previous
slide
• And you dynamically calculate upper level members of the
Accounts dimension
• Will the variance calculate correctly for upper level
members of accounts? Why or why not?
![Page 18: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/18.jpg)
Workshop
• You have an outline with the following dimensions:
• Accounts – dense
• Periods – dense
• Scenario – sparse
• Organization – sparse
• You want to add a variance to the Scenario dimension to
calculate Actual vs. Budget
• What storage option should Variance be?
• Dynamic Calc
![Page 19: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/19.jpg)
Workshop
• Given the dense and sparse settings from the previous
slide
• And you dynamically calculate upper level members of
the Accounts dimension
• Will the variance calculate correctly for upper level
members of accounts? Why or why not?
• No – Dynamic calcs are performed in the following order:
• Sparse will calculate before dense
• Within Dense, it’s outline order
• Two-Pass is last (sparse before dense)
• Variance will need to be tagged two pass so that it is calculated
after the dynamic rollup of accounts
![Page 20: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/20.jpg)
Check Your Understanding
• What is the default consolidation order for an Essbase
outline?
• If Accounts is dense and Time is dense, how many passes
will be made through the database?
• Why would making upper level members of the Accounts
dimension help calculation performance?
• How many passes through the database are
performed on this calc script:
• (Q1; Q2;) Q3;
• Where these are stored members of a dense
dimension
![Page 21: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/21.jpg)
Check Your Understanding
• What is the default consolidation order for an Essbase
outline?
• First, Accounts
• Second, Time
• Third, remaining dense dimensions
• Fourth, remaining sparse dimensions
• Two Pass Calculation
• If Accounts is dense and Time is dense, how many passes
will be made through the database?
• One
![Page 22: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/22.jpg)
Check Your Understanding
• Why would making upper level members of the Accounts
dimension help calculation performance?
• Wouldn’t have to calculate the accounts dimension
• Smaller block size
• How many passes through the database are
performed on this calc script:
• (Q1; Q2;) Q3;
• Where these are stored members of a dense
dimension
• 2 passes
![Page 23: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/23.jpg)
Design & Optimize Calculations
Review - Calc Script Basics
![Page 24: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/24.jpg)
What is a Calc Script?
• Series of commands, equations, and formulas that control
calculation of the database
• Text files with a .CSC extension
•/* Creates Initial Budget */
•SET UPDATECALC OFF;
•CLEARDATA Budget;
•Budget = Actual * 1.1;
•CALC ALL;
![Page 25: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/25.jpg)
Why Use a Calc Script?
• Define calc order
• Calculate a subset of data
• Clear or copy data
• Calculate formulas not in outline
• Perform multiple-pass calculations
• Create and use temporary variables
![Page 26: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/26.jpg)
Try to Limit Cross-Dims
• Using cross-dimensional operator:
• Faster, easier to maintain: •FIX (Sales)
• Budget = Actual * 1.1;
•ENDFIX
•FIX (Budget)
• Sales = Sales->Actual * 1.1;
•ENDFIX
![Page 27: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/27.jpg)
Clearing Data
• Clear a subset of the database based on a sparse
dimension:
• Clear a subset of the database based on a dense
dimension:
•FIX (“Fruit Soda”, “Texas”)
• CLEARBLOCK ALL;
•ENDFIX
•CLEARDATA Actual->Sales;
![Page 28: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/28.jpg)
Copy Data
• Copy all values for one member to another:
• Copy a subset of values:
•FIX (Sales, COGS)
• DATACOPY Actual TO Budget;
•ENDFIX
•DATACOPY Actual TO Budget;
![Page 29: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/29.jpg)
Copy Data cont.
• Another way to copy a subset of values:
• Still another way to copy a subset of values:
•FIX (Sales, COGS)
• Actual = Budget;
•ENDFIX
•FIX (Actual)
• Sales = Sales->Budget;
• COGS = COGS->Budget;
•ENDFIX
![Page 30: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/30.jpg)
Multi-pass Calculations
• Use to perform goal-seeking or simultaneous equations
(circular references)
• Example of a simultaneous equation:
•LOOP(30)
• Bonus = Profit * .1;
• Profit;
•ENDLOOP;
![Page 31: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/31.jpg)
Create and Use Temporary Variables
• Create initial budget based on a value stored in a variable:
•VAR BudgetInc = 0.1;
•SET UPDATECALC OFF;
•FIX (Sales, COGS)
• Budget = Actual * (1 + BudgetInc);
•ENDFIX
•CALC ALL;
![Page 32: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/32.jpg)
Agg
• Syntax
• AGG(Dimname, Dimname,…);
• Summary
• Aggregates dimension(s) according to the outline operators
• Member formulas are ignored
• Very fast
• Fewer than 6 levels
![Page 33: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/33.jpg)
Calc Dim
• Syntax
• Calc Dim(DimName, DimName,…)
• Summary
• Calculates the dimensions that are listed
• All dense dimensions are calculated first in the order they
appear
• Sparse dimensions are calculated last - also in the order they
appear
• If you need a different order, use multiple Calc Dim commands
• Includes member formulas
![Page 34: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/34.jpg)
ClearBlock vs. ClearData
• ClearBlock is designed to clear an entire block
• At least a large portion of the block
• No Member name, just block type
• ClearData is designed to clear a member
• Usually before it is recalculated
• In many cases either one will work
![Page 35: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/35.jpg)
DataCopy
• Syntax
• DataCopy MemberName TO MemberName;
• Summary
• Copies data from one member to another
• All intersections are included
• Great for copying versions
• Will create blocks if they do not exist
![Page 36: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/36.jpg)
If/Else/ElseIf/EndIf
• Syntax
• IF (condition) ElseIf/Else EndIf;
• Summary
• Condition must be if parenthesis
• In a calc script, associate with a member name
• Does really matter which member name
• Each If must end with EndIf
• Most effective on dense members
![Page 37: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/37.jpg)
Fix/EndFix
• Synatx
• Fix(MemberNames, Functions Etc.) ENDFIX
• Summary
• Used to focus or limit a calculation
• Most effective on sparse members
• Used extensively
![Page 38: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/38.jpg)
Focusing Calculations
• Two most common methods
• Fix
• If
• Other methods:
• CrossDim operator
• MemberSet functions
• Relationship functions
• Variables
![Page 39: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/39.jpg)
FIX
• FIX limits the members that are processed
• Most effective when used on members of sparse
dimensions
• Only blocks that meet the Fix criteria are processed
• Remaining blocks are simply skipped
• Typical uses
• Only calculate one scenario
• Limit calc to current year
![Page 40: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/40.jpg)
More on FIX
• FIX works properly on dense members
• May result in all blocks being processed
• All statements between the FIX and ENDFIX are executed
as a block
• FIX statements can be nested
• Multiple members from the same dimension are treated as
“or”
• In other words, all members will be processed
![Page 41: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/41.jpg)
What You Cannot Do With FIX
• You cannot assign values to a member that is included in
the FIX statement
• Actually, values cannot be assigned to any member from a
dimension in the FIX statement
• Example
• Fix(Sales)
• Sales = 100;
• ENDFIX
• Would result in an error
![Page 42: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/42.jpg)
FIX On
• Members from one or more dimensions
• Can list specific member names
• Can include member set functions
• Can include AND and OR
• Use AND to get the intersection of two or more functions
• Caution on empty sets
![Page 43: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/43.jpg)
IF Statements
• Conditional processing is often needed to process
business rules
• Can include complex conditions
• And, Or, Not, etc.
![Page 44: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/44.jpg)
To If or FIX
• Generally, IF works best on dense dimension members
• Particularly when ElseIF or Else are included
• Block is only brought into memory once and all related conditions are processed
• FIX works best on sparse dimension members
• Old saying “Fix on Sparse, If on dense”
• There are always exceptions
• BUT… avoid unnecessary IFs when, say, a FIX would do
![Page 45: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/45.jpg)
FIX Workshop
• What does this calc script do?
• Essbase 9.0 can skip an empty FIX
SET UpdateCalc Off;
FIX (@CHILDREN(“100-10”))
Actual = #Missing;
ENDFIX
SET EmptyMemberSets On;
SET UpdateCalc Off;
FIX (@CHILDREN(“100-10”))
Sales = 100;
ENDFIX
![Page 46: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/46.jpg)
IF vs. FIX examples
• This is a waste of an IF
• This works better
FIX (Jan, Feb)
Sales = 100;
ENDFIX
Sales (
IF (@ISMBR(Jan, Feb))
Sales=100;
ENDIF)
![Page 47: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/47.jpg)
IF vs. FIX examples
• This is a good use of an IF
• Even better
Sales (
IF (@ISMBR(Jan))
Sales=100;
ELSEIF (@ISMBR(Feb))
Sales=200;
ENDIF)
FIX (Sales)
Jan=100;
Feb=200;
ENDFIX
![Page 48: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/48.jpg)
IF vs. FIX examples
• This is a bad use of an IF
• FIX in this case
Sales (
IF (@ISMBR(Texas))
Sales=100;
ELSEIF (@ISMBR(Florida))
Sales=200;
ENDIF)
FIX (Texas)
Sales=100;
ENDFIX
FIX (Florida)
Sales=200;
ENDFIX
![Page 49: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/49.jpg)
IF Optimization
• While we’re on the subject
• A “calc member block” is just a member formula, so no
need to repeat “Sales”
Sales (
IF (@ISMBR(Jan))
Sales=100;
ENDIF)
Sales (
IF (@ISMBR(Jan))
100;
ENDIF)
![Page 50: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/50.jpg)
Checking for #Missing or Zero
• This is the old-school way of checking for a non-value
• Combine the two checks into one
Sales (
IF (Jan==#Missing or Jan==0))
100;
ENDIF)
Sales (
IF (Jan + 0 == 0)
100;
ENDIF)
![Page 51: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/51.jpg)
Replacing zeros with #Missing
• Old-school way
• Don’t need an IF
Actual (
IF (Actual==0)
#Missing;
ENDIF)
SET UpdateCalc Off;
Actual = Actual * Actual / Actual ;
![Page 52: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/52.jpg)
@IS Functions outside of IF
• This works
• This is faster (and more confusing to read)
Sales (
IF (@ISUDA(Market,"Major Market"))
100 ;
ELSE
#Missing;
ENDIF)
Sales = 100 / @ISUDA(Market,"Major Market");
![Page 53: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/53.jpg)
Other Method to Focus Calculations
• “Cross Dim” operator
• Allows reference to specific cells
• Frequently in another block
• Technique for complex allocations
• Relationship functions
• Can be used to get a value from another part of the database
• Example is @ParentVal(…)
• MemberSet functions
• Return member names
• Can be used to calculate those members or in a Fix/If
![Page 54: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/54.jpg)
Why Create Blocks
• Often need blocks that do not exist
• Typically when performing allocations
• Actually, one of the most challenging aspects of writing
calc scripts
• If a block does not exist, not processed by a calc script
• Except outline calculations
• Frequent cause of calculation problems
• Example
• IF (Budget > 100)
• Actual = 50;
• ENDIF
• Assumes Scenario is sparse
![Page 55: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/55.jpg)
Ways to Create Blocks
• There are basically four methods to create blocks:
• Load data
• Calculate the database
• Use the DataCopy command
• Place a sparse member on the left side of an assignment statement
• Must not set equal to a constant
• SET CREATEBLOCKONEQ ON|OFF;
• SET CREATENONMISSINGBLK ON|OFF;
![Page 56: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/56.jpg)
Load Data
• During a data load, a block is created if it doesn’t already
exist
• Can use this to create blocks
• Create data records based on source information
• Load the file
• One trick is to use the Replace function of the load rule
![Page 57: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/57.jpg)
Calculate the Database
• An outline rollup will create upper level blocks
• Both Calc All/Dim and AGG will cause blocks to be created
• Only blocks containing data are created
• Empty blocks are not written
![Page 58: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/58.jpg)
DataCopy Command
• Easiest way to create blocks
• If an intersection for the “To” member does not exist, it is
created
• Frequently, the only practical method to create the needed
blocks
• Danger in that it can create excessive numbers of blocks
![Page 59: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/59.jpg)
Assignment Statements
• If
• The member on the left of the assignment statement is
sparse
• And
• The database setting “Create bocks on equations” is
selected
• Blocks are created
• Not always possible to have a sparse member
on the left side of the assignment statement
• Try fixing on a dense member and assigning to a
sparse member
• E.g. Fix on the account member and assign to another
• May need to change dense/sparse settings
![Page 60: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/60.jpg)
Workshop
• Which is the more efficient calc script?
•FIX (Sales)
• Budget = Actual * 1.2;
•ENDFIX
•FIX (Budget)
• Sales = Sales->Actual * 1.2;
•ENDFIX
![Page 61: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/61.jpg)
Workshop
• Which is the more efficient calc script?
• Limit cross dim operators if possible
•FIX (Sales)
• Budget = Actual * 1.2;
•ENDFIX
•FIX (Budget)
• Sales = Sales->Actual * 1.2;
•ENDFIX
![Page 62: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/62.jpg)
Workshop
• You have a sales analysis application with the following dimensions:
• Accounts – dense (member formulas and all upper levels are stored)
• Periods – dense (no member formulas and all upper levels are stored)
• Product – sparse (no member formulas and all upper levels are stored)
• Region – sparse (no member formulas and all upper levels are stored)
• Scenario – sparse (member formulas on dynamically calc’d members)
• Introduction date – attribute dimension (no member formulas)
• Sales Manager – attribute dimension (no member formulas)
![Page 63: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/63.jpg)
Workshop
• Choose the best consolidation calc script:
•CALC DIM(ACCOUNTS, PERIODS);
•AGG(PRODUCT, REGION, SCENARIO, “INTRODUCTION DATE”, “SALES MANAGER”);
•CALC DIM(ACCOUNTS);
•AGG(PERIODS, PRODUCT, REGION);
•CALC DIM(ACCOUNTS, PERIODS, PRODUCT, REGION, SCENARIO, “INTRODUCTION DATE”, “SALES MANAGER”);
•CALC DIM(ACCOUNTS, PERIODS);
•AGG(PRODUCT, REGION);
![Page 64: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/64.jpg)
Workshop
• Choose the best consolidation calc script:
•CALC DIM(ACCOUNTS, PERIODS);
•AGG(PRODUCT, REGION, SCENARIO, “INTRODUCTION DATE”, “SALES MANAGER”);
•CALC DIM(ACCOUNTS);
•AGG(PERIODS, PRODUCT, REGION);
•CALC DIM(ACCOUNTS, PERIODS, PRODUCT, REGION, SCENARIO, “INTRODUCTION DATE”, “SALES MANAGER”);
•CALC DIM(ACCOUNTS, PERIODS);
•AGG(PRODUCT, REGION);
![Page 65: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/65.jpg)
Check Your Understanding
• Choose the true statement:
• If/then – dense dimensions; fix – sparse dimensions
• If/then – sparse dimensions; fix – dense dimensions
• You need to clear Actuals data (which is in the sparse
Scenario dimension). What command should you use?
• How can you create a block in Essbase?
![Page 66: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/66.jpg)
Check Your Understanding
• Choose the true statement:
• If/then – dense dimensions; fix – sparse dimensions
• If/then – sparse dimensions; fix – dense dimensions
• You need to clear Actuals data (which is in the sparse
Scenario dimension). What command should you use?
• CLEARBLOCK
![Page 67: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/67.jpg)
Check Your Understanding
• How can you create a block in Essbase?
• Load data
• Calculate the database
• Use the DataCopy command
• Place a sparse member on the left side of an assignment statement
• SET CREATENONMISSINGBLK ON|OFF;
![Page 68: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/68.jpg)
Design & Optimize Calculations
Tips and Tricks
![Page 69: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/69.jpg)
Goal
• Make the calculation run faster
• Variety of settings/changes available to make things run
faster
• Many limiting factors
• Existing reports/processes
• Source systems
• Hardware
![Page 70: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/70.jpg)
Serial vs. Parallel Calculation
• Serial Calculation
• Default
• Current Essbase behavior
• Each calc is executed serially
• Parallel Calculation
• Set at system, application, database or calc script
• Generates tasks
• Schedules tasks to run on up to 4 threads
• Operating system can schedule each thread on a separate
CPU
![Page 71: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/71.jpg)
Parallel Calculation
• Apply multiple processors to a calc
• Only straight forward calcs can use this
• If order dependent portions, calculated in serial
• Maximum of 4 processors
• Recommend 1 less than number on server
• Available in Essbase XTD Analytic Services 6.5
![Page 72: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/72.jpg)
Parallel Calculations
• Set at the server, application, database or individual calc
script level
• Can run on up to 4 threads
• Essbase will analyze the outline and calculation request to
determine if parallel calc is possible
• Check the application log to see how parallel calc is being
used
• Calculating in parallel with [2] threads
![Page 73: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/73.jpg)
Parallel Calculation
• Essbase will review the request
• Complex formula interdependencies will force a serial calc
• If parallel processing is feasible, Essbase splits the request
into independent tasks that can be run concurrently
![Page 74: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/74.jpg)
Parallel Calculations
• Set number of worker threads
• In essbase.cfg – CALCPARALLEL appname dbname n
• In calc script – SET CALCPARALLEL n
• N = 1 through 4; default is 1
• Set number of dimensions in task suffix
• In essbase.cfg – NUMTASKDIMS appname dbname n
• In calc script – SET NUMTASKDIMS n
• N = 1 to number of sparse dimensions
• Use when fixing on the last sparse dimension
![Page 75: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/75.jpg)
Cache Settings
• More is not always better
• Sometime Hyperion Essbase seems to spend more time
maintaining caches than calculating
• Usually find a point where increasing cache does not
improve performance
• Typically a trial and error process
• Set uncommitted / 0 on “Transaction” tab
![Page 76: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/76.jpg)
Dense/Sparse Settings
• This will make the largest difference
• Other factors influence decisions
• Attribute dimensions
• If only a portion of the database is calculated ideally you
want to “Fix” on it as sparse members
• Reduces the number of blocks processed
• May need to try a number of combinations
• Smaller blocks almost always calc faster
![Page 77: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/77.jpg)
Control Calculation Environment
• Use SET Commands
• Set CACHE HIGH;
• New cache
• Tracks the block used in the calc
• Set CALCHASHTBL ON;
• Good for flat dimensions
• Set FromBottomUp ON;
• Faster than TopDown
• Make sure you get correct results
![Page 78: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/78.jpg)
FRMBOTTOMUP
• Top down calculations are less efficient b/c more
blocks are calculated then necessary
• By default Essbase does bottoms up
• You can explicitly force a bottoms up calc by:
• @CALCMODE in a formula
• SET FRMBOTTOMUP in a calc script
• CALCOPTFRMLBOTTOM UP in Essbase.cfg
• Increases performance
![Page 79: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/79.jpg)
Set Functions in Calc Scripts
• Set AggMissg – defines whether to aggregate #missing
child values and overwrite a parent value with #missing.
Improves performance if set to ON.
• Set Cache – defines the amount of calculator cache to be
applied to this script. Improves performance if properly set.
• Set LockBlocks – defines the amount of lockblocks to be
applied to this script.
• Set Msg – defines the type of information to be reported by
the calculator.
• Set UpdateCalc – defines whether to use intelligent
calculation capabilities.
![Page 80: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/80.jpg)
More SET Commands
• SET LOCKBLOCK HIGH;
• Allows more blocks to be locked
• Not really optimization but …
• SET CALCTASKDIMS n;
• Determines how many dimensions are used to generate
opportunities for the parallel calculation
![Page 81: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/81.jpg)
Dynamic Calc
• Can improve calc times significantly
• Make entire dimension dynamic calc
• Never needs to be calculated
• Especially effective for Time dimension
• Normally calculates very slowly
• All upper level members of dense dimension
• Keeps block smaller
• Upper 1-2 levels of sparse dimension(s)
• Be aware of how many blocks are needed to calc highest level
![Page 82: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/82.jpg)
Custom Functions
• Can write functions in Java
• Compile, save on server, and register
• Call from calc scripts
• Run slower than same calc command
• May run faster than complex series of database passes
required to perform the same thing
![Page 83: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/83.jpg)
Custom Macros
• Can predefine combinations of commands
• SumRange is actually a Macro
• Combines Sum and Range functions
• Not necessarily faster but might avoid errors
• Need to define parameters
• May be possible to save a pass of blocks
![Page 84: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/84.jpg)
Database Statistics
• Not a optimization technique but a tool
• Can monitor calculation impacts
• Number of blocks created
• Can refresh while calc is running
• Block creation rate
• Not necessarily best for the calc…
• Copy and paste into Excel
![Page 85: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/85.jpg)
Sparse Dimension Aggregation Order
• Sparse dimensional aggregation should be ordered from
fewest blocks created to most blocks created
• To find this information
1. Load data into the database and record the total number of blocks
using the Essbase application manager
2. Calculate a single Sparse dimension
3. Again record the total number of blocks using the Essbase
application manager
4. Repeat for all Sparse dimensions
![Page 86: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/86.jpg)
Block Mode
• @CALCMODE (within a calc script)
• Cell
• Block
• Top Down
• Bottom up
• By default Essbase uses block mode
• Block mode groups cells within a block and simaltaneously
calcuates the cells in each group
• Block mode is faster
• Block mode can cause data dependency issues
![Page 87: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/87.jpg)
Cell Mode
• Cell mode calculates each cell sequentially
• Functions that cause cell mode calculation: • @ANCEST
• @CURRMBR
• @ISMBR on a dense member
• @MDANCESTVAL
• @MDPARENTVAL
• @MDSHIFT
• @NEXT
• @PARENT
• @PARENTVAL
• @PRIOR
• @SANCESTVAL
• @SPARENTVAL
• @SHIFT
![Page 88: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/88.jpg)
Intelligent Calculation
• Intelligent calculation allows Essbase to remember which
blocks in the database need to be calculated based on new
data coming in, and which haven’t been impacted (and
don’t need calculation)
• Intelligent calculation is wonderful when you’re running a
default calc
• But intelligent calculation is the devil’s work when you’re
running a calc script
![Page 89: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/89.jpg)
Intelligent Calculation
• Use only on databases with no complex calculations or
formulas
• Use on those databases that simply aggregate
• Proves most effective for sparse incremental updates
![Page 90: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/90.jpg)
Review Blocks that are Processed
• Can use “SET MSG DETAIL”
• Each block is listed as it is calculated
• See application log
• Can determine number of times each block is processed
• Can also see if expected blocks are being processed
• Often, extra blocks are being read
• Correct by updating FIX
![Page 91: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/91.jpg)
Simulate the Calculation
• Method to predict the actual calc time
• Based on the number of blocks that would be created
• SET MSG ONLY;
• SET NOTICE HIGH;
• CALC ALL;
• Does not actually calc the database but provides timings
• Run the calc, and use ratio of actual time to simulated
• Not perfect but…
![Page 92: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/92.jpg)
Testing Calc Scripts
• The following methodology works well:
• Use a test database
• Create test data in Excel
• Keep it on its own sheet
• Clear the database
• Use Lock & Send to load test data
• Run the calc from Excel
• Retrieve onto a test sheet
![Page 93: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/93.jpg)
More on Testing
• Best to know expected outcome before retrieving
• Can create a calc script to clear the database
• Minimizes switching between Excel and App Manager
• The key is small amounts of data which allows short test
cycles
• Many people test with large amounts of data resulting in long cycles
and inability to get many tests in per day
• When initial testing is complete, add to the test data set to
make sure everything is working properly
![Page 94: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/94.jpg)
Typical Issues
• Intelligent Calc
• Prevents blocks from being calculated
• FIX on too few or too many members
• Nested FIX’s are OR’s, not AND’s
• Dynamic Calc runs after Batch Calc
• Dynamic calc members do not make good counters
• Referring to the wrong block
• Remember, every intersection is processed unless the calculation
is focused
![Page 95: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/95.jpg)
Recap - Calculation Optimization Tips
• @XREF
• If you are using @XREF on dynamic calcs, exclude from calcs
• @XREF will only work on existing blocks
• Calc only those dimensions requiring calculation
• Example – Do you need to rollup Scenario (Actual + Budget)?
• AGG and CALC DIM are not the same
• Agg is faster for straight aggregating dimensions
• Fix on Sparse, If on Dense
• Reduce the number of passes through the database
• Simplify if possible
• Unary calcs instead of formulas
• Dynamic calcs, Dynamic Time Series
![Page 96: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/96.jpg)
Check Your Understanding
• How do you turn on parallel calc?
• When should you use intelligent calculation?
• Which is faster – cell mode or block mode?
• What are potential issues with block mode?
• What functions force cell mode?
![Page 97: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/97.jpg)
Check Your Understanding
• How do you turn on parallel calc?
• Set number of worker threads • In essbase.cfg – CALCPARALLEL appname dbname n
• In calc script – SET CALCPARALLEL n
• Set number of dimensions in task suffix • In essbase.cfg – NUMTASKDIMS appname dbname n
• In calc script – SET NUMTASKDIMS n
• When should you use intelligent calculation?
• Most of the time turn intelligent calc OFF
• Using default calc and running sparse incremental updates
• Which is faster – cell mode or block mode?
• Block mode
• What are potential issues with block mode?
• Data dependency issues
![Page 98: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/98.jpg)
Check Your Understanding
• What functions force cell mode?
• @ANCEST
• @CURRMBR
• @ISMBR on a dense member
• @MDANCESTVAL
• @MDPARENTVAL
• @MDSHIFT
• @NEXT
• @PARENT
• @PARENTVAL
• @PRIOR
• @SANCESTVAL
• @SPARENTVAL
• @SHIFT
![Page 99: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/99.jpg)
Calculation Scripts
and Member Formulas
Questions?
![Page 100: Optimizing Oracle Essbase Formulas - …dbmanagement.info/Books/MIX/Optimizing_Oracle_ESSBASE_Formul… · Optimizing Oracle Essbase Formulas & Calc Scripts ... Hyperion • Oracle](https://reader038.fdocuments.in/reader038/viewer/2022102920/5ac214547f8b9ae45b8e2217/html5/thumbnails/100.jpg)
Optimizing Oracle Essbase Formulas &
Calc Scripts
NOTE: Slides will not be distributed.
Edward Roske
BLOG: LookSmarter.blogspot.com
WEBSITE: www.interrel.com
TWITTER: Eroske