Oracle® OLAP DML Reference 11g Release 1 (11.1) Part Number B28126-01 |
|
|
View PDF |
The management of aggregate data within analytic workspaces can have significant performance implications. To determine an optimal set of dimension member combinations to preaggregate, you can use the ADVISE_REL
and ADVISE_CUBE
procedures in the DBMS_AW
package. These procedures are known together as the Aggregate Advisor.
Based on a percentage that you specify, ADVISE_REL
suggests a set of dimension members to preaggregate. The ADVISE_CUBE
procedure suggests a set of members for each dimension of a cube.
Instructions for storing aggregate data are specified in an analytic workspace object called an aggmap. The OLAP DML AGGREGATE
command uses the aggmap to preaggregate the data. Any data that is not preaggregated is aggregated dynamically by the AGGREGATE
function when the data is queried.
Choosing a balance between static and dynamic aggregation depends on many factors including disk space, available memory, and the nature and frequency of the queries that will run against the data. After weighing these factors, you may arrive at a percentage of the data to preaggregate.
Once you have determined the percentage of the data to preaggregate, you can use the Aggregate Advisor. These procedures analyze the distribution of dimension members within hierarchies and identify an optimal set of dimension members to preaggregate.
Based on a precompute percentage that you specify, the ADVISE_REL
procedure analyzes a family relation, which represents a dimension with all its hierarchical relationships, and returns a list of dimension members.
ADVISE_CUBE
applies similar heuristics to each dimension in an aggmap for a cube.
Example B-2, "ADVISE_REL: Suggested Preaggregation of the Customer Dimension" uses the following sample Customer dimension to illustrate the ADVISE_REL
procedure.
Sample Dimension: Customer in the Analytic Workspace
The Customer dimension in MYAW_AW.MYAW
has two hierarchies: SHIPMENTS_ROLLUP
with four levels, and MARKET_ROLLUP
with three levels. The dimension has 106 members. This number includes all members at each level and all level names.
The members of the Customer dimension are integer keys whose text values are defined in long and short descriptions.
The following OLAP DML commands show information about the representation of the Customer dimension.
SQL>set serveroutput on ---- Number of members of Customer dimension SQL>execute dbms_aw.execute('show statlen(customer)') 106 ---- Hierarchies in Customer dimension; SQL>execute dbms_aw.execute('rpr w 40 customer_hierlist'); CUSTOMER_HIERLIST ---------------------------------------- MARKET_ROLLUP SHIPMENTS_ROLLUP ---- Levels in Customer dimension SQL>execute dbms_aw.execute('rpr w 40 customer_levellist'); CUSTOMER_LEVELLIST ---------------------------------------- TOTAL_CUSTOMER REGION WAREHOUSE TOTAL_MARKET MARKET_SEGMENT ACCOUNT SHIP_TO ---- Levels in each hierarchy from leaf to highest SQL>execute dbms_aw.execute('report w 20 customer_hier_levels'); CUSTOMER_HIERL IST CUSTOMER_HIER_LEVELS -------------- -------------------- SHIPMENTS SHIP_TO WAREHOUSE REGION TOTAL_CUSTOMER MARKET_SEGMENT SHIP_TO ACCOUNT MARKET_SEGMENT TOTAL_MARKET ---- Parent relation showing parent-child relationships in the Customer dimension ---- Only show the last 20 members SQL>execute dbms_aw.execute('limit customer to last 20'); SQL>execute dbms_aw.execute('rpr w 10 down customer w 20 customer_parentrel'); -----------CUSTOMER_PARENTREL------------ ------------CUSTOMER_HIERLIST------------ CUSTOMER MARKET_ROLLUP SHIPMENTS_ROLLUP ---------- -------------------- -------------------- 103 44 21 104 45 21 105 45 21 106 45 21 7 NA NA 1 NA NA 8 NA 1 9 NA 1 10 NA 1 11 NA 8 12 NA 10 13 NA 9 14 NA 9 15 NA 8 16 NA 9 17 NA 8 18 NA 8 19 NA 9 20 NA 9 21 NA 10 ---- Show text descriptions for the same twenty dimension members SQL>execute dbms_aw.execute('report w 15 down customer w 35 across customer_hierlist: <customer_short_description>'); ALL_LANGUAGES: AMERICAN_AMERICA ---------------------------CUSTOMER_HIERLIST--------------------------- -----------MARKET_ROLLUP----------- ---------SHIPMENTS_ROLLUP---------- CUSTOMER CUSTOMER_SHORT_DESCRIPTION CUSTOMER_SHORT_DESCRIPTION --------------- ----------------------------------- ----------------------------------- 103 US Marine Svcs Washington US Marine Svcs Washington 104 Warren Systems New York Warren Systems New York 105 Warren Systems Philladelphia Warren Systems Philladelphia 106 Warren Systems Boston Warren Systems Boston 7 Total Market NA 1 NA All Customers 8 NA Asia Pacific 9 NA Europe 10 NA North America 11 NA Australia 12 NA Canada 13 NA France 14 NA Germany 15 NA Hong Kong 16 NA Italy 17 NA Japan 18 NA Singapore 19 NA Spain 20 NA United Kingdom 21 NA United States
Example B-2 ADVISE_REL: Suggested Preaggregation of the Customer Dimension
This example uses the MYAW
Customer dimension described in "Sample Dimension: Customer in the Analytic Workspace".
The following PL/SQL statements assume that you want to preaggregate 25% of the Customer dimension. ADVISE_REL
returns the suggested set of members in a valueset.
SQL>set serveroutput on SQL>execute dbms_aw.execute('aw attach myaw_aw.myaw'); SQL>execute dbms_aw.execute('define customer_preagg valueset customer'); SQL>execute dbms_aw.advise_rel('customer_parentrel', 'customer_preagg', 25); SQL>execute dbms_aw.execute('show values(customer_preagg)'); 31 2 4 5 6 7 1 8 9 20 21
The returned Customer members with their text descriptions, related levels, and related hierarchies, are shown as follows.
Customer Member | Description | Hierarchy | Level |
---|---|---|---|
31 |
Kosh Enterprises |
MARKET_ROLLUP |
ACCOUNT |
2 |
Consulting |
MARKET_ROLLUP |
MARKET_SEGMENT |
4 |
Government |
MARKET_ROLLUP |
MARKET_SEGMENT |
5 |
Manufacturing |
MARKET_ROLLUP |
MARKET_SEGMENT |
6 |
Reseller |
MARKET_ROLLUP |
MARKET_SEGMENT |
7 |
TOTAL_MARKET |
MARKET_ROLLUP |
TOTAL_MARKET |
1 |
TOTAL_CUSTOMER |
SHIPMENTS_ROLLUP |
TOTAL_CUSTOMER |
8 |
Asia Pacific |
SHIPMENTS_ROLLUP |
REGION |
9 |
Europe |
SHIPMENTS_ROLLUP |
REGION |
20 |
United Kingdom |
SHIPMENTS_ROLLUP |
WAREHOUSE |
21 |
United States |
SHIPMENTS_ROLLUP |
WAREHOUSE |