SlideShare a Scribd company logo
1 of 92
BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF
HAMBURG KOPENHAGEN LAUSANNE MÜNCHEN STUTTGART WIEN ZÜRICH
Analytic views in Oracle 12.2
The virtual cube
Kim Berg Hansen
Senior Consultant
About me
Analytic views in Oracle 12.22 12/8/2017
• Danish geek
• SQL & PL/SQL developer since 2000
• Developer at Trivadis AG since 2016
http://www.trivadis.dk
• Oracle Certified Expert in SQL
• Oracle ACE
• Blogger at http://www.kibeha.dk
• SQL quizmaster at
http://devgym.oracle.com
• Likes to cook
• Reads sci-fi
• Member of Danish Beer Enthusiasts
3 Membership Tiers
• Oracle ACE Director
• Oracle ACE
• Oracle ACE Associate
bit.ly/OracleACEProgram
500+ Technical Experts
Helping Peers Globally
Connect:
Nominate yourself or someone you know: acenomination.oracle.com
@oracleace
Facebook.com/oracleaces
oracle-ace_ww@oracle.com
About Trivadis
Analytic views in Oracle 12.24 12/8/2017
Trivadis is a market leader in IT consulting, system integration, solution engineering
and the provision of IT services focusing on and
technologies in Switzerland, Germany, Austria and Denmark.
We offer our services in the following strategic business fields:
Trivadis Services takes over the interacting operation of your IT systems.
O P E R A T I O N
COPENHAGEN
MUNICH
LAUSANNE
BERN
ZURICH
BRUGG
GENEVA
HAMBURG
DÜSSELDORF
FRANKFURT
STUTTGART
FREIBURG
BASEL
VIENNA
With over 600 specialists and IT experts in your region
Analytic views in Oracle 12.25 12/8/2017
14 Trivadis branches and more than
600 employees
260 Service Level Agreements
Over 4,000 training participants
Research and development budget:
EUR 5.0 million
Financially self-supporting and
sustainably profitable
Experience from more than 1,900
projects per year at over 800
customers
Analytic Views in Oracle 12.2 - Agenda
Analytic views in Oracle 12.26 12/8/2017
1. Concepts
2. ATTRIBUTE DIMENSION
3. HIERARCHY
4. ANALYTIC VIEW
5. Querying with SQL
6. Performance
7. Classifications
8. Summary
Analytic views in Oracle 12.27 12/8/2017
Concepts
Like a view – but dimensional
Analytic views in Oracle 12.28 12/8/2017
Reports
View SQL
RelationalMetadataRelational Query
Like a view – but dimensional
Analytic views in Oracle 12.28 12/8/2017
Reports
View SQL
RelationalMetadataRelational Query
Reports
Analytic
View
SQL
(expanded)
DimensionalMetadataRelational Query
Virtual
Like a view – but dimensional
Analytic views in Oracle 12.28 12/8/2017
Reports
View SQL
RelationalMetadataRelational Query
Reports
Analytic
View
SQL
(expanded)
DimensionalMetadataRelational Query
Like a dimensional OLAP cube – but virtual
Analytic views in Oracle 12.29 12/8/2017
Reports
Copy MDX
DatawarehouseETLRelational Query
Copy
Build Cube
Virtual (not copying data)
Like a dimensional OLAP cube – but virtual
Analytic views in Oracle 12.29 12/8/2017
Reports
Copy MDX
DatawarehouseETLRelational Query
Reports
Analytic
View
SQL
(expanded)
DimensionalMetadataRelational Query
Copy
Build Cube
(m)view
join
join
join
Anatomy of Analytic View: Metadata object types
Analytic views in Oracle 12.210 12/8/2017
Dimension
Table
Tables+view
(Materialized?)
Fact
Table
Relational
Relational
(m)view
join
join
join
Virtual (not copying data)
Anatomy of Analytic View: Metadata object types
Analytic views in Oracle 12.210 12/8/2017
Dimension
Table
Tables+view
(Materialized?)
Fact
Table
Attribute
Dimension
Attr. Dimension
Definition of:
- Attributes
- Levels
- Member keys
- Member names
Attr. Dimension
Definition of:
- Attributes
- Levels
- Member keys
- Member names
Relational
Relational
(m)view
join
join
join
Virtual (not copying data)
Anatomy of Analytic View: Metadata object types
Analytic views in Oracle 12.210 12/8/2017
Dimension
Table
Tables+view
(Materialized?)
Fact
Table
Attribute
Dimension
Hierarchy
Attr. Dimension
Definition of:
- Attributes
- Levels
- Member keys
- Member names
Attr. Dimension
Definition of:
- Attributes
- Levels
- Member keys
- Member names
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Relational
Relational
(m)view
join
join
join
Virtual (not copying data)
Anatomy of Analytic View: Metadata object types
Analytic views in Oracle 12.210 12/8/2017
Dimension
Table
Tables+view
(Materialized?)
Fact
Table
Attribute
Dimension
Hierarchy Analytic View
Attr. Dimension
Definition of:
- Attributes
- Levels
- Member keys
- Member names
Attr. Dimension
Definition of:
- Attributes
- Levels
- Member keys
- Member names
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Analytic view
Definition of:
- Fact<->Dimensions
relationships
- Available hierarchies
- Fact measures
- Calculated measures
- Aggregates to use
Relational
Relational
(m)view
join
join
join
Virtual (not copying data)
Anatomy of Analytic View: Metadata object types
Analytic views in Oracle 12.210 12/8/2017
Dimension
Table
SQL
(expanded)
Tables+view
(Materialized?)
Fact
Table
Attribute
Dimension
Hierarchy Analytic View
Attr. Dimension
Definition of:
- Attributes
- Levels
- Member keys
- Member names
Attr. Dimension
Definition of:
- Attributes
- Levels
- Member keys
- Member names
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Hierarchy
Definition of:
Parent-Child
relations of
attr.dim. levels
Analytic view
Definition of:
- Fact<->Dimensions
relationships
- Available hierarchies
- Fact measures
- Calculated measures
- Aggregates to use
Relational
Relational
12.2 Application Containers
Analytic views in Oracle 12.211 12/8/2017
SHARE WITH clause is available for the object types
– Attribute dimensions
– Hierarchies
– Analytic views
Allows the objects to be shared across application containers
Sharing can be either
– NONE - share nothing (default)
– METADATA - share metadata (definition) only
– OBJECT - share entire object, both metadata as well as data
Analytic views in Oracle 12.212 12/8/2017
ATTRIBUTE DIMENSION
ATTRIBUTE DIMENSION
Analytic views in Oracle 12.213 12/8/2017
Metadata – not storing values. Values stay in base table(s)
Based on a regular table with dimension values
Or multiple tables joined and denormalized:
– via regular view
– or via materialized view
Defining all possible member attributes of the dimension
Defining all possible levels of the dimension:
– which attributes are keys, alternate keys, names and ordering
– which attributes determine other attributes
ATTRIBUTE DIMENSION - Standard
Analytic views in Oracle 12.214 12/8/2017
create table item_dim (
item_id integer primary key
, item_name varchar2(20) not null unique
, category_id integer not null
, category_name varchar2(20) not null
);
Denormalized dimension table
ATTRIBUTE DIMENSION - Standard
Analytic views in Oracle 12.214 12/8/2017
create table item_dim (
item_id integer primary key
, item_name varchar2(20) not null unique
, category_id integer not null
, category_name varchar2(20) not null
);
Denormalized dimension table
create or replace attribute dimension item_attr_dim
dimension type standard
using item_dim
attributes (
item_id, item_name, category_id, category_name
)
level item key item_id
member name item_name
order by item_name
determines (category_id)
level category key category_id
member name category_name
order by category_name
all member name 'ALL ITEMS';
Attribute dimension
create table country_dim (
country_id integer primary key
, country_name varchar2(20) not null );
create table state_dim (
state_id integer primary key
, state_name varchar2(20) not null
, country_id integer not null references country_dim );
create table custgroup_dim (
custgroup_id integer primary key
, custgroup_name varchar2(20) not null );
create table customer_dim (
customer_id integer primary key
, customer_name varchar2(20) not null
, state_id integer not null references state_dim
, custgroup_id integer not null references custgroup_dim );
ATTRIBUTE DIMENSION – Branched levels
Analytic views in Oracle 12.215 12/8/2017
Normalized dimension tables
create table country_dim (
country_id integer primary key
, country_name varchar2(20) not null );
create table state_dim (
state_id integer primary key
, state_name varchar2(20) not null
, country_id integer not null references country_dim );
create table custgroup_dim (
custgroup_id integer primary key
, custgroup_name varchar2(20) not null );
create table customer_dim (
customer_id integer primary key
, customer_name varchar2(20) not null
, state_id integer not null references state_dim
, custgroup_id integer not null references custgroup_dim );
ATTRIBUTE DIMENSION – Branched levels
Analytic views in Oracle 12.215 12/8/2017
Normalized dimension tables
create or replace view customer_dim_view as
select c.customer_id , c.customer_name
, cg.custgroup_id , cg.custgroup_name
, s.state_id , s.state_name
, co.country_id , co.country_name
from customer_dim c
join custgroup_dim cg on cg.custgroup_id = c.custgroup_id
join state_dim s on s.state_id = c.state_id
join country_dim co on co.country_id = s.country_id;
/*
Could be materialized view – periodic or ON COMMIT refresh
*/
Denormalized dimension view
create table country_dim (
country_id integer primary key
, country_name varchar2(20) not null );
create table state_dim (
state_id integer primary key
, state_name varchar2(20) not null
, country_id integer not null references country_dim );
create table custgroup_dim (
custgroup_id integer primary key
, custgroup_name varchar2(20) not null );
create table customer_dim (
customer_id integer primary key
, customer_name varchar2(20) not null
, state_id integer not null references state_dim
, custgroup_id integer not null references custgroup_dim );
ATTRIBUTE DIMENSION – Branched levels
Analytic views in Oracle 12.215 12/8/2017
Normalized dimension tables
create or replace view customer_dim_view as
select c.customer_id , c.customer_name
, cg.custgroup_id , cg.custgroup_name
, s.state_id , s.state_name
, co.country_id , co.country_name
from customer_dim c
join custgroup_dim cg on cg.custgroup_id = c.custgroup_id
join state_dim s on s.state_id = c.state_id
join country_dim co on co.country_id = s.country_id;
/*
Could be materialized view – periodic or ON COMMIT refresh
*/
Denormalized dimension view
create or replace attribute dimension customer_attr_dim
using customer_dim_view
attributes ( customer_id, customer_name, custgroup_id, custgroup_name
, state_id , state_name , country_id , country_name )
level customer key customer_id
member name customer_name
determines (custgroup_id, state_id)
level custgroup key custgroup_id
member name custgroup_name
level state key state_id
member name state_name
determines (country_id)
level country key country_id
member name country_name
all member name 'ALL CUSTOMERS';
Attribute dimension
create table date_dim (
date_id date primary key
, date_name varchar2(10) not null unique
, month_id integer not null
, month_name varchar2(10) not null
, qtr_id integer not null
, qtr_name varchar2(10) not null
, year_id integer not null
, year_name varchar2(4) not null
, mthofyr_id integer not null
, mthofyr_name varchar2(3) not null
, season_id integer not null
, season_name varchar2(10) not null
);
ATTRIBUTE DIMENSION – Dimension type TIME
Analytic views in Oracle 12.216 12/8/2017
Dimension table
create table date_dim (
date_id date primary key
, date_name varchar2(10) not null unique
, month_id integer not null
, month_name varchar2(10) not null
, qtr_id integer not null
, qtr_name varchar2(10) not null
, year_id integer not null
, year_name varchar2(4) not null
, mthofyr_id integer not null
, mthofyr_name varchar2(3) not null
, season_id integer not null
, season_name varchar2(10) not null
);
ATTRIBUTE DIMENSION – Dimension type TIME
Analytic views in Oracle 12.216 12/8/2017
Dimension table
insert into date_dim
select date_date as date_id , to_char(date_date,'YYYY-MM-DD') date_name
, to_number(to_char(date_date,'YYYYMM')) month_id, to_char(date_date,'YYYY-MM') month_name
, to_number(to_char(date_date,'YYYYQ')) qtr_id , to_char(date_date,'YYYY-"Q"Q') qtr_name
, to_number(to_char(date_date,'YYYY')) year_id , to_char(date_date,'YYYY') year_name
, extract(month from date_date) mthofyr_id , to_char(date_date,'FMMon'
, 'nls_date_language=american') mthofyr_name
, case when extract(month from date_date) in (12,1,2) then 1
when extract(month from date_date) in (3,4,5 ) then 2
when extract(month from date_date) in (6,7,8 ) then 3
when extract(month from date_date) in (9,10,11) then 4 end season_id
, case when extract(month from date_date) in (12,1,2) then 'Winter'
when extract(month from date_date) in (3,4,5 ) then 'Spring'
when extract(month from date_date) in (6,7,8 ) then 'Summer'
when extract(month from date_date) in (9,10,11) then 'Fall' end season_name
from (
select date '2014-01-01' + level - 1 date_date from dual
connect by level <= date '2017-12-31' - date '2014-01-01' + 1
)
order by date_id;
Populate table
create table date_dim (
date_id date primary key
, date_name varchar2(10) not null unique
, month_id integer not null
, month_name varchar2(10) not null
, qtr_id integer not null
, qtr_name varchar2(10) not null
, year_id integer not null
, year_name varchar2(4) not null
, mthofyr_id integer not null
, mthofyr_name varchar2(3) not null
, season_id integer not null
, season_name varchar2(10) not null
);
ATTRIBUTE DIMENSION – Dimension type TIME
Analytic views in Oracle 12.216 12/8/2017
Dimension table
insert into date_dim
select date_date as date_id , to_char(date_date,'YYYY-MM-DD') date_name
, to_number(to_char(date_date,'YYYYMM')) month_id, to_char(date_date,'YYYY-MM') month_name
, to_number(to_char(date_date,'YYYYQ')) qtr_id , to_char(date_date,'YYYY-"Q"Q') qtr_name
, to_number(to_char(date_date,'YYYY')) year_id , to_char(date_date,'YYYY') year_name
, extract(month from date_date) mthofyr_id , to_char(date_date,'FMMon'
, 'nls_date_language=american') mthofyr_name
, case when extract(month from date_date) in (12,1,2) then 1
when extract(month from date_date) in (3,4,5 ) then 2
when extract(month from date_date) in (6,7,8 ) then 3
when extract(month from date_date) in (9,10,11) then 4 end season_id
, case when extract(month from date_date) in (12,1,2) then 'Winter'
when extract(month from date_date) in (3,4,5 ) then 'Spring'
when extract(month from date_date) in (6,7,8 ) then 'Summer'
when extract(month from date_date) in (9,10,11) then 'Fall' end season_name
from (
select date '2014-01-01' + level - 1 date_date from dual
connect by level <= date '2017-12-31' - date '2014-01-01' + 1
)
order by date_id;
Populate table
create or replace attribute dimension date_attr_dim dimension type time using date_dim
attributes ( date_id , date_name , month_id , month_name , qtr_id , qtr_name
, year_id , year_name , mthofyr_id , mthofyr_name , season_id , season_name )
level day level type days key date_id member name date_name
order by date_id determines (month_id, mthofyr_id)
level month level type months key month_id member name month_name
order by month_id determines (qtr_id, mthofyr_id)
level quarter level type quarters key qtr_id member name qtr_name
order by qtr_id determines (year_id)
level year level type years key year_id member name year_name
order by year_id
level mthofyr level type months key mthofyr_id member name mthofyr_name
order by mthofyr_id determines (season_id)
level season level type quarters key season_id member name season_name
order by season_id
all member name 'ALL DATES';
Attribute dimension
Analytic views in Oracle 12.217 12/8/2017
HIERARCHY
HIERARCHY
Analytic views in Oracle 12.218 12/8/2017
Metadata – not storing values. Values stay in base table(s)
Based on attribute dimension
Defining parent->child relations for the levels of a dimension
Multiple hierarchies may exist for one dimension
Generates virtual columns and rows for the hierarchy
Is a row source – you can SELECT from a hierarchy
HIERARCHY - Single
Analytic views in Oracle 12.219 12/8/2017
create or replace attribute dimension item_attr_dim
dimension type standard
using item_dim
attributes (
item_id, item_name, category_id, category_name
)
level item key item_id
member name item_name
order by item_name
determines (category_id)
level category key category_id
member name category_name
order by category_name
all member name 'ALL ITEMS';
Attribute dimension
HIERARCHY - Single
Analytic views in Oracle 12.219 12/8/2017
create or replace attribute dimension item_attr_dim
dimension type standard
using item_dim
attributes (
item_id, item_name, category_id, category_name
)
level item key item_id
member name item_name
order by item_name
determines (category_id)
level category key category_id
member name category_name
order by category_name
all member name 'ALL ITEMS';
Attribute dimension
create or replace hierarchy item_category_hier
using item_attr_dim
(
item
child of category
);
Hierarchy
Columns of a hierarchy
Analytic views in Oracle 12.220 12/8/2017
ITEM_ID
ITEM_NAME
CATEGORY_ID
CATEGORY_NAME
MEMBER_NAME
MEMBER_UNIQUE_NAME
MEMBER_CAPTION
MEMBER_DESCRIPTION
LEVEL_NAME
HIER_ORDER
DEPTH
IS_LEAF
PARENT_LEVEL_NAME
PARENT_UNIQUE_NAME
Dimension attribute columns / rows + generated hierarchical columns / rows
Columns of a hierarchy
Analytic views in Oracle 12.220 12/8/2017
ITEM_ID
ITEM_NAME
CATEGORY_ID
CATEGORY_NAME
MEMBER_NAME
MEMBER_UNIQUE_NAME
MEMBER_CAPTION
MEMBER_DESCRIPTION
LEVEL_NAME
HIER_ORDER
DEPTH
IS_LEAF
PARENT_LEVEL_NAME
PARENT_UNIQUE_NAME
Dimension attribute columns / rows + generated hierarchical columns / rows
230
Bikini
2
For the beach
Bikini
[ITEM].&[230]
ITEM
2
2
1
CATEGORY
[CATEGORY].&[2]
Columns of a hierarchy
Analytic views in Oracle 12.220 12/8/2017
ITEM_ID
ITEM_NAME
CATEGORY_ID
CATEGORY_NAME
MEMBER_NAME
MEMBER_UNIQUE_NAME
MEMBER_CAPTION
MEMBER_DESCRIPTION
LEVEL_NAME
HIER_ORDER
DEPTH
IS_LEAF
PARENT_LEVEL_NAME
PARENT_UNIQUE_NAME
Dimension attribute columns / rows + generated hierarchical columns / rows
230
Bikini
2
For the beach
Bikini
[ITEM].&[230]
ITEM
2
2
1
CATEGORY
[CATEGORY].&[2]
2
For the beach
For the beach
[CATEGORY].&[2]
CATEGORY
1
1
0
ALL
[ALL].[ALL ITEMS]
Columns of a hierarchy
Analytic views in Oracle 12.220 12/8/2017
ITEM_ID
ITEM_NAME
CATEGORY_ID
CATEGORY_NAME
MEMBER_NAME
MEMBER_UNIQUE_NAME
MEMBER_CAPTION
MEMBER_DESCRIPTION
LEVEL_NAME
HIER_ORDER
DEPTH
IS_LEAF
PARENT_LEVEL_NAME
PARENT_UNIQUE_NAME
Dimension attribute columns / rows + generated hierarchical columns / rows
230
Bikini
2
For the beach
Bikini
[ITEM].&[230]
ITEM
2
2
1
CATEGORY
[CATEGORY].&[2]
2
For the beach
For the beach
[CATEGORY].&[2]
CATEGORY
1
1
0
ALL
[ALL].[ALL ITEMS]
130
Bob sled
1
Winter sports
Bob sled
[ITEM].&[130]
ITEM
7
2
1
CATEGORY
[CATEGORY].&[1]
Columns of a hierarchy
Analytic views in Oracle 12.220 12/8/2017
ITEM_ID
ITEM_NAME
CATEGORY_ID
CATEGORY_NAME
MEMBER_NAME
MEMBER_UNIQUE_NAME
MEMBER_CAPTION
MEMBER_DESCRIPTION
LEVEL_NAME
HIER_ORDER
DEPTH
IS_LEAF
PARENT_LEVEL_NAME
PARENT_UNIQUE_NAME
Dimension attribute columns / rows + generated hierarchical columns / rows
230
Bikini
2
For the beach
Bikini
[ITEM].&[230]
ITEM
2
2
1
CATEGORY
[CATEGORY].&[2]
2
For the beach
For the beach
[CATEGORY].&[2]
CATEGORY
1
1
0
ALL
[ALL].[ALL ITEMS]
130
Bob sled
1
Winter sports
Bob sled
[ITEM].&[130]
ITEM
7
2
1
CATEGORY
[CATEGORY].&[1]
1
Winter sports
Winter sports
[CATEGORY].&[1]
CATEGORY
6
1
0
ALL
[ALL].[ALL ITEMS]
Columns of a hierarchy
Analytic views in Oracle 12.220 12/8/2017
ITEM_ID
ITEM_NAME
CATEGORY_ID
CATEGORY_NAME
MEMBER_NAME
MEMBER_UNIQUE_NAME
MEMBER_CAPTION
MEMBER_DESCRIPTION
LEVEL_NAME
HIER_ORDER
DEPTH
IS_LEAF
PARENT_LEVEL_NAME
PARENT_UNIQUE_NAME
Dimension attribute columns / rows + generated hierarchical columns / rows
230
Bikini
2
For the beach
Bikini
[ITEM].&[230]
ITEM
2
2
1
CATEGORY
[CATEGORY].&[2]
2
For the beach
For the beach
[CATEGORY].&[2]
CATEGORY
1
1
0
ALL
[ALL].[ALL ITEMS]
130
Bob sled
1
Winter sports
Bob sled
[ITEM].&[130]
ITEM
7
2
1
CATEGORY
[CATEGORY].&[1]
1
Winter sports
Winter sports
[CATEGORY].&[1]
CATEGORY
6
1
0
ALL
[ALL].[ALL ITEMS]
ALL ITEMS
[ALL].[ALL ITEMS]
ALL
0
0
0
Hierarchy tree
Analytic views in Oracle 12.221 12/8/2017
select hier_order
, lpad(' ', depth * 2)
|| case is_leaf
when 0 then '+ '
else '- '
end
|| member_name as tree
, member_unique_name
from item_category_hier
order by hier_order;
HIER_ORDER gives tree ordering, use DEPTH and IS_LEAF to picture tree
HIER_ORDER TREE MEMBER_UNIQUE_NAME
---------- -------------------- ------------------
0 + ALL ITEMS [ALL].[ALL ITEMS]
1 + For the beach [CATEGORY].&[2]
2 - Bikini [ITEM].&[230]
3 - Sunglasses [ITEM].&[200]
4 - Surfboard [ITEM].&[220]
5 - Volleyball [ITEM].&[210]
6 + Winter sports [CATEGORY].&[1]
7 - Bob sled [ITEM].&[130]
8 - Ice skates [ITEM].&[110]
9 - Ski gloves [ITEM].&[120]
10 - Snowboard [ITEM].&[100]
11 rows selected.
Hierarchy tree
Analytic views in Oracle 12.221 12/8/2017
select hier_order
, lpad(' ', depth * 2)
|| case is_leaf
when 0 then '+ '
else '- '
end
|| member_name as tree
, member_unique_name
from item_category_hier
order by hier_order;
HIER_ORDER gives tree ordering, use DEPTH and IS_LEAF to picture tree
create or replace attribute dimension customer_attr_dim
using customer_dim_view
attributes ( customer_id, customer_name, custgroup_id, custgroup_name
, state_id , state_name , country_id , country_name )
level customer key customer_id
member name customer_name
determines (custgroup_id, state_id)
level custgroup key custgroup_id
member name custgroup_name
level state key state_id
member name state_name
determines (country_id)
level country key country_id
member name country_name
all member name 'ALL CUSTOMERS';
HIERARCHY - Multiple
Analytic views in Oracle 12.222 12/8/2017
Attribute dimension
create or replace attribute dimension customer_attr_dim
using customer_dim_view
attributes ( customer_id, customer_name, custgroup_id, custgroup_name
, state_id , state_name , country_id , country_name )
level customer key customer_id
member name customer_name
determines (custgroup_id, state_id)
level custgroup key custgroup_id
member name custgroup_name
level state key state_id
member name state_name
determines (country_id)
level country key country_id
member name country_name
all member name 'ALL CUSTOMERS';
HIERARCHY - Multiple
Analytic views in Oracle 12.222 12/8/2017
Attribute dimension
create or replace hierarchy customer_group_hier
using customer_attr_dim
(
customer
child of custgroup
);
Hierarchy
create or replace attribute dimension customer_attr_dim
using customer_dim_view
attributes ( customer_id, customer_name, custgroup_id, custgroup_name
, state_id , state_name , country_id , country_name )
level customer key customer_id
member name customer_name
determines (custgroup_id, state_id)
level custgroup key custgroup_id
member name custgroup_name
level state key state_id
member name state_name
determines (country_id)
level country key country_id
member name country_name
all member name 'ALL CUSTOMERS';
HIERARCHY - Multiple
Analytic views in Oracle 12.222 12/8/2017
Attribute dimension
create or replace hierarchy customer_group_hier
using customer_attr_dim
(
customer
child of custgroup
);
Hierarchy
create or replace hierarchy customer_state_country_hier
using customer_attr_dim
(
customer
child of state
child of country
);
Hierarchy
create or replace attribute dimension date_attr_dim dimension type time using date_dim
attributes ( date_id , date_name , month_id , month_name , qtr_id , qtr_name
, year_id , year_name , mthofyr_id , mthofyr_name , season_id , season_name )
level day level type days key date_id member name date_name
order by date_id determines (month_id, mthofyr_id)
level month level type months key month_id member name month_name
order by month_id determines (qtr_id, mthofyr_id)
level quarter level type quarters key qtr_id member name qtr_name
order by qtr_id determines (year_id)
level year level type years key year_id member name year_name
order by year_id
level mthofyr level type months key mthofyr_id member name mthofyr_name
order by mthofyr_id determines (season_id)
level season level type quarters key season_id member name season_name
order by season_id
all member name 'ALL DATES';
HIERARCHY – Dimension type TIME
Analytic views in Oracle 12.223 12/8/2017
Attribute dimension
create or replace attribute dimension date_attr_dim dimension type time using date_dim
attributes ( date_id , date_name , month_id , month_name , qtr_id , qtr_name
, year_id , year_name , mthofyr_id , mthofyr_name , season_id , season_name )
level day level type days key date_id member name date_name
order by date_id determines (month_id, mthofyr_id)
level month level type months key month_id member name month_name
order by month_id determines (qtr_id, mthofyr_id)
level quarter level type quarters key qtr_id member name qtr_name
order by qtr_id determines (year_id)
level year level type years key year_id member name year_name
order by year_id
level mthofyr level type months key mthofyr_id member name mthofyr_name
order by mthofyr_id determines (season_id)
level season level type quarters key season_id member name season_name
order by season_id
all member name 'ALL DATES';
HIERARCHY – Dimension type TIME
Analytic views in Oracle 12.223 12/8/2017
Attribute dimension
create or replace hierarchy date_mth_qtr_yr_hier
using date_attr_dim
(
day
child of month
child of quarter
child of year
);
Hierarchy
create or replace attribute dimension date_attr_dim dimension type time using date_dim
attributes ( date_id , date_name , month_id , month_name , qtr_id , qtr_name
, year_id , year_name , mthofyr_id , mthofyr_name , season_id , season_name )
level day level type days key date_id member name date_name
order by date_id determines (month_id, mthofyr_id)
level month level type months key month_id member name month_name
order by month_id determines (qtr_id, mthofyr_id)
level quarter level type quarters key qtr_id member name qtr_name
order by qtr_id determines (year_id)
level year level type years key year_id member name year_name
order by year_id
level mthofyr level type months key mthofyr_id member name mthofyr_name
order by mthofyr_id determines (season_id)
level season level type quarters key season_id member name season_name
order by season_id
all member name 'ALL DATES';
HIERARCHY – Dimension type TIME
Analytic views in Oracle 12.223 12/8/2017
Attribute dimension
create or replace hierarchy date_mth_qtr_yr_hier
using date_attr_dim
(
day
child of month
child of quarter
child of year
);
Hierarchy
create or replace hierarchy date_mth_season_hier
using date_attr_dim
(
day
child of mthofyr
child of season
);
Hierarchy
Analytic views in Oracle 12.224 12/8/2017
ANALYTIC VIEW
ANALYTIC VIEW
Analytic views in Oracle 12.225 12/8/2017
Metadata – not storing values. Values stay in base table
Based on fact table, attribute dimensions and hierarchies
Defining relations between fact and one or more dimensions
Defining which hierarchies of the dimension can be used in the view
Defining measures:
– Based on fact columns or calculations
– Expanded analytic syntax supports hierarchies
– Defines which aggregations to be used on measures
ANALYTIC VIEW
Analytic views in Oracle 12.226 12/8/2017
create table sales_fact (
sales_date date not null references date_dim
, item_id integer not null references item_dim
, customer_id integer not null references customer_dim
, qty number not null
, amount number not null
, cost number not null
);
Fact table
ANALYTIC VIEW
Analytic views in Oracle 12.226 12/8/2017
create table sales_fact (
sales_date date not null references date_dim
, item_id integer not null references item_dim
, customer_id integer not null references customer_dim
, qty number not null
, amount number not null
, cost number not null
);
Fact table
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Analytic view
Dimension clauses
Analytic views in Oracle 12.227 12/8/2017
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Analytic view
Dimension clauses
Analytic views in Oracle 12.227 12/8/2017
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Analytic view
date_attr_dim
key sales_date references date_id
hierarchies ( date_mth_qtr_yr_hier default
, date_wk_yr_hier
, date_mth_season_hier )
, item_attr_dim
key item_id references item_id
hierarchies ( item_category_hier default )
, customer_attr_dim
key customer_id references customer_id
hierarchies ( customer_group_hier default
, customer_state_country_hier )
Dimension clauses
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Measure clauses
Analytic views in Oracle 12.228 12/8/2017
Analytic view
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Measure clauses
Analytic views in Oracle 12.228 12/8/2017
Analytic view
qty fact qty
, amount fact amount
, cost fact cost
, max_qty fact qty aggregate by max
, avg_amount fact amount aggregate by avg
, profit as (amount - cost)
, piece_profit as (profit / nullif(qty,0))
, margin as (100 * profit / nullif(amount,0))
Simple
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Measure clauses
Analytic views in Oracle 12.228 12/8/2017
Analytic view
qty fact qty
, amount fact amount
, cost fact cost
, max_qty fact qty aggregate by max
, avg_amount fact amount aggregate by avg
, profit as (amount - cost)
, piece_profit as (profit / nullif(qty,0))
, margin as (100 * profit / nullif(amount,0))
Simple
, amount_prior_period as (
lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_next_period as (
lead(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_prior_qtr as (
lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1
across ancestor at level quarter)
)
, amount_diff_prior_period as (
lag_diff(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_diff_pct_prior_period as (
lag_diff_percent(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
Lead / Lag
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Measure clauses
Analytic views in Oracle 12.228 12/8/2017
Analytic view
qty fact qty
, amount fact amount
, cost fact cost
, max_qty fact qty aggregate by max
, avg_amount fact amount aggregate by avg
, profit as (amount - cost)
, piece_profit as (profit / nullif(qty,0))
, margin as (100 * profit / nullif(amount,0))
Simple
, amount_prior_period as (
lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_next_period as (
lead(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_prior_qtr as (
lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1
across ancestor at level quarter)
)
, amount_diff_prior_period as (
lag_diff(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_diff_pct_prior_period as (
lag_diff_percent(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
Lead / Lag
, cost_ytd as (
sum(cost) over (
hierarchy date_mth_qtr_yr_hier
between unbounded preceding and current member
within ancestor at level year
)
)
, cost_qtd as (
sum(cost) over (
hierarchy date_mth_qtr_yr_hier
between unbounded preceding and current member
within ancestor at level quarter
)
)
Window
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Measure clauses
Analytic views in Oracle 12.228 12/8/2017
Analytic view
qty fact qty
, amount fact amount
, cost fact cost
, max_qty fact qty aggregate by max
, avg_amount fact amount aggregate by avg
, profit as (amount - cost)
, piece_profit as (profit / nullif(qty,0))
, margin as (100 * profit / nullif(amount,0))
Simple
, amount_prior_period as (
lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_next_period as (
lead(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_prior_qtr as (
lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1
across ancestor at level quarter)
)
, amount_diff_prior_period as (
lag_diff(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_diff_pct_prior_period as (
lag_diff_percent(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
Lead / Lag
, cost_ytd as (
sum(cost) over (
hierarchy date_mth_qtr_yr_hier
between unbounded preceding and current member
within ancestor at level year
)
)
, cost_qtd as (
sum(cost) over (
hierarchy date_mth_qtr_yr_hier
between unbounded preceding and current member
within ancestor at level quarter
)
)
Window
, margin_2014 as (
qualify( margin, date_mth_qtr_yr_hier = year[2014] )
)
, margin_2015_point_diff_2014 as (
qualify( margin, date_mth_qtr_yr_hier = year[2015] )
- qualify( margin, date_mth_qtr_yr_hier = year[2014] )
)
, cost_ytd_prior_year as (
qualify(
cost_ytd , date_mth_qtr_yr_hier = hier_lag(
current member offset 1
across ancestor at level year
)
)
)
Qualify (QDR)
create or replace analytic view sales_av
using sales_fact
dimension by (
((dimension clauses))
)
measures (
((measure clauses))
)
default measure amount
default aggregate by sum;
Measure clauses
Analytic views in Oracle 12.228 12/8/2017
Analytic view
qty fact qty
, amount fact amount
, cost fact cost
, max_qty fact qty aggregate by max
, avg_amount fact amount aggregate by avg
, profit as (amount - cost)
, piece_profit as (profit / nullif(qty,0))
, margin as (100 * profit / nullif(amount,0))
Simple
, amount_prior_period as (
lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_next_period as (
lead(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_prior_qtr as (
lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1
across ancestor at level quarter)
)
, amount_diff_prior_period as (
lag_diff(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
, amount_diff_pct_prior_period as (
lag_diff_percent(amount) over (hierarchy date_mth_qtr_yr_hier offset 1)
)
Lead / Lag
, cost_ytd as (
sum(cost) over (
hierarchy date_mth_qtr_yr_hier
between unbounded preceding and current member
within ancestor at level year
)
)
, cost_qtd as (
sum(cost) over (
hierarchy date_mth_qtr_yr_hier
between unbounded preceding and current member
within ancestor at level quarter
)
)
Window
, margin_2014 as (
qualify( margin, date_mth_qtr_yr_hier = year[2014] )
)
, margin_2015_point_diff_2014 as (
qualify( margin, date_mth_qtr_yr_hier = year[2015] )
- qualify( margin, date_mth_qtr_yr_hier = year[2014] )
)
, cost_ytd_prior_year as (
qualify(
cost_ytd , date_mth_qtr_yr_hier = hier_lag(
current member offset 1
across ancestor at level year
)
)
)
Qualify (QDR)
, profit_share_geo_parent as (
share_of( profit hierarchy customer_state_country_hier parent )
)
, profit_share_category as (
share_of( profit hierarchy item_category_hier level category )
)
Share of
Analytic views in Oracle 12.229 12/8/2017
Querying with SQL
Expanded SQL
Analytic views in Oracle 12.230 12/8/2017
Much added analytic syntax within analytic view definitions
Hierarchies member names allow MDX-like member filter
SELECT can query from analytic view, specifying desired hierarchies
Analytic view measures and hierarchy columns can be used as normal column
expressions in select list, where clause, etc.
As it is all metadata, selecting from analytic view and hierarchies is actually rewritten
to SQL with joins, aggregations and calculations on the base tables
Query example
Analytic views in Oracle 12.231 12/8/2017
select date_mth_qtr_yr_hier.member_name as month
, amount, amount_prior_period, amount_diff_prior_period
, round(amount_diff_pct_prior_period * 100, 1) as pct
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.level_name = 'MONTH'
order by date_mth_qtr_yr_hier.hier_order;
Query
Query example
Analytic views in Oracle 12.231 12/8/2017
select date_mth_qtr_yr_hier.member_name as month
, amount, amount_prior_period, amount_diff_prior_period
, round(amount_diff_pct_prior_period * 100, 1) as pct
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.level_name = 'MONTH'
order by date_mth_qtr_yr_hier.hier_order;
Query
MONTH AMOUNT AMOUNT_PRIOR_PERIOD AMOUNT_DIFF_PRIOR_PERIOD PCT
---------- ---------- ------------------- ------------------------ ----------
2014-01 179918.38
2014-02 162298.66 179918.38 -17619.72 -9.8
2014-03 83065.78 162298.66 -79232.88 -48.8
2014-04 79792.79 83065.78 -3272.99 -3.9
2014-05 82464.93 79792.79 2672.14 3.3
2014-06 121360.52 82464.93 38895.59 47.2
2014-07 125733.23 121360.52 4372.71 3.6
2014-08 126837.02 125733.23 1103.79 .9
...
2017-09 71217.78 125615.93 -54398.15 -43.3
2017-10 73094.69 71217.78 1876.91 2.6
2017-11 70147.02 73094.69 -2947.67 -4
2017-12 179949.06 70147.02 109802.04 156.5
48 rows selected.
Output
Query example
Analytic views in Oracle 12.232 12/8/2017
select date_mth_qtr_yr_hier.member_name as quarter
, amount, amount_prior_period
, cost_ytd, cost_ytd_prior_year
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.parent_unique_name = '[YEAR].&[2015]'
order by date_mth_qtr_yr_hier.hier_order;
Query
Query example
Analytic views in Oracle 12.232 12/8/2017
select date_mth_qtr_yr_hier.member_name as quarter
, amount, amount_prior_period
, cost_ytd, cost_ytd_prior_year
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.parent_unique_name = '[YEAR].&[2015]'
order by date_mth_qtr_yr_hier.hier_order;
Query
QUARTER AMOUNT AMOUNT_PRIOR_PERIOD COST_YTD COST_YTD_PRIOR_YEAR
---------- ---------- ------------------- ---------- -------------------
2015-Q1 423988.68 324418.81 148103.48 148394.1
2015-Q2 284102.26 423988.68 244424.98 244437.42
2015-Q3 321613.01 284102.26 352579.29 352676.94
2015-Q4 323018.87 321613.01 466129.48 466399.24
Output
Query example
Analytic views in Oracle 12.233 12/8/2017
select lpad(' ', date_mth_qtr_yr_hier.depth * 2)
|| date_mth_qtr_yr_hier.member_name as period
, qty, max_qty, cost, cost_qtd
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.year_id = 2015
and date_mth_qtr_yr_hier.is_leaf = 0
order by date_mth_qtr_yr_hier.hier_order;
Query
Query example
Analytic views in Oracle 12.233 12/8/2017
select lpad(' ', date_mth_qtr_yr_hier.depth * 2)
|| date_mth_qtr_yr_hier.member_name as period
, qty, max_qty, cost, cost_qtd
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.year_id = 2015
and date_mth_qtr_yr_hier.is_leaf = 0
order by date_mth_qtr_yr_hier.hier_order;
Query
PERIOD QTY MAX_QTY COST COST_QTD
--------------- ---------- ---------- ---------- ----------
2015 25844 14 466129.48
2015-Q1 7792 14 148103.48 148103.48
2015-01 3469 14 63084.74 63084.74
2015-02 3117 14 56645.04 119729.78
2015-03 1206 7 28373.7 148103.48
2015-Q2 5466 14 96321.5 96321.5
2015-04 1164 7 27785.33 27785.33
2015-05 1206 7 28432.84 56218.17
2015-06 3096 14 40103.33 96321.5
2015-Q3 7291 14 108154.31 108154.31
2015-07 3190 14 41473.46 41473.46
2015-08 3189 14 41514.96 82988.42
2015-09 912 7 25165.89 108154.31
2015-Q4 5295 14 113550.19 113550.19
2015-10 936 7 25682.68 25682.68
2015-11 899 7 24789.31 50471.99
2015-12 3460 14 63078.2 113550.19
Output
Query example
Analytic views in Oracle 12.234 12/8/2017
select date_mth_qtr_yr_hier.member_name as year
, qty, amount, amount_next_period, cost, profit
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.level_name = 'YEAR'
order by date_mth_qtr_yr_hier.hier_order;
Query
Query example
Analytic views in Oracle 12.234 12/8/2017
select date_mth_qtr_yr_hier.member_name as year
, qty, amount, amount_next_period, cost, profit
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.level_name = 'YEAR'
order by date_mth_qtr_yr_hier.hier_order;
Query
YEAR QTY AMOUNT AMOUNT_NEXT_PERIOD COST PROFIT
---------- ---------- ---------- ------------------ ---------- ----------
2014 25823 1356119.17 1352722.82 466399.24 889719.93
2015 25844 1352722.82 1360671.25 466129.48 886593.34
2016 25968 1360671.25 1357019.68 468413.17 892258.08
2017 25845 1357019.68 467039.17 889980.51
Output
Query example
Analytic views in Oracle 12.235 12/8/2017
select lpad(' ', item_category_hier.depth * 2)
|| item_category_hier.member_name as item_category
, qty, amount, profit, margin
from sales_av hierarchies (
item_category_hier, date_mth_season_hier
)
where date_mth_season_hier.member_unique_name = '[SEASON].&[3]' --Summer
order by item_category_hier.hier_order;
Query
Query example
Analytic views in Oracle 12.235 12/8/2017
select lpad(' ', item_category_hier.depth * 2)
|| item_category_hier.member_name as item_category
, qty, amount, profit, margin
from sales_av hierarchies (
item_category_hier, date_mth_season_hier
)
where date_mth_season_hier.member_unique_name = '[SEASON].&[3]' --Summer
order by item_category_hier.hier_order;
Query
ITEM_CATEGORY QTY AMOUNT PROFIT MARGIN
--------------- ---------- ---------- ---------- ----------
ALL ITEMS 37876 1494665.2 1001155.45 66.9819201
For the beach 36402 1457944.92 977999.28 67.0806741
Bikini 9105 354302.87 264750.11 74.7242352
Sunglasses 9107 185334.38 120266.14 64.8914357
Surfboard 9090 774906.81 482142.21 62.2193796
Volleyball 9100 143400.86 110840.82 77.29439
Winter sports 1474 36720.28 23156.17 63.0609843
Bob sled 368 4631.11 3623.35 78.2393422
Ice skates 367 13153.87 7476.55 56.839166
Ski gloves 369 2457.34 1121.98 45.6583135
Snowboard 370 16477.96 10934.29 66.3570612
Output
Query example
Analytic views in Oracle 12.236 12/8/2017
select lpad(' ', customer_state_country_hier.depth * 2)
|| customer_state_country_hier.member_name as cust_state_ctry
, qty, amount, avg_amount, profit
from sales_av hierarchies (
customer_state_country_hier, item_category_hier
)
where item_category_hier.member_unique_name = '[CATEGORY].&[2]' --Beach
order by customer_state_country_hier.hier_order;
Query
Query example
Analytic views in Oracle 12.236 12/8/2017
select lpad(' ', customer_state_country_hier.depth * 2)
|| customer_state_country_hier.member_name as cust_state_ctry
, qty, amount, avg_amount, profit
from sales_av hierarchies (
customer_state_country_hier, item_category_hier
)
where item_category_hier.member_unique_name = '[CATEGORY].&[2]' --Beach
order by customer_state_country_hier.hier_order;
Query
CUST_STATE_CTRY QTY AMOUNT AVG_AMOUNT PROFIT
---------------------- ---------- ---------- ---------- ----------
ALL CUSTOMERS 52082 2387671.07 179.026098 1594808.4
Germany 29797 1163811.78 167.768744 750617.64
Bayern 12555 460764.43 172.765066 302102.11
ABCD GmbH 10013 254860.06 159.387154 158966.79
Heinz Schubert 2542 205904.37 192.794354 143135.32
Niedersachsen 17242 703047.35 164.648091 448515.53
Backhaus Buhl 10021 218548.99 136.507801 122567.05
Gemeinde Stade 4678 307779.42 192.362138 212103.28
Heidi Schmidt 2543 176718.94 165.312385 113845.2
USA 22285 1223859.29 191.228014 844190.76
California 9746 807579.34 216.10365 586449.67
Jack Howell 2538 215165.23 201.465571 152604.75
Jill Hamilton 2540 215224.69 201.332732 152618.92
LAPD 4668 377189.42 235.743388 281226
New Hampshire 12539 416279.95 156.319921 257741.09
Sam Flyingbear 2536 186109.84 174.587092 123362.15
Woods Burgers 10003 230170.11 144.126556 134378.94
Output
Query example
Analytic views in Oracle 12.237 12/8/2017
select lpad(' ', customer_state_country_hier.depth * 2)
|| customer_state_country_hier.member_name as country
, lpad(' ', item_category_hier.depth * 2)
|| item_category_hier.member_name as category
, qty, amount
from sales_av hierarchies (
customer_state_country_hier
, item_category_hier
, date_mth_season_hier
)
where customer_state_country_hier.depth <= 1
and item_category_hier.depth <= 1
and date_mth_season_hier.member_unique_name = '[MTHOFYR].&[4]' --April
order by customer_state_country_hier.hier_order
, item_category_hier.hier_order;
Query
Query example
Analytic views in Oracle 12.237 12/8/2017
select lpad(' ', customer_state_country_hier.depth * 2)
|| customer_state_country_hier.member_name as country
, lpad(' ', item_category_hier.depth * 2)
|| item_category_hier.member_name as category
, qty, amount
from sales_av hierarchies (
customer_state_country_hier
, item_category_hier
, date_mth_season_hier
)
where customer_state_country_hier.depth <= 1
and item_category_hier.depth <= 1
and date_mth_season_hier.member_unique_name = '[MTHOFYR].&[4]' --April
order by customer_state_country_hier.hier_order
, item_category_hier.hier_order;
Query
COUNTRY CATEGORY QTY AMOUNT
--------------- --------------- ---------- ----------
ALL CUSTOMERS ALL ITEMS 4668 319763.47
ALL CUSTOMERS For the beach 3140 210251.43
ALL CUSTOMERS Winter sports 1528 109512.04
Germany ALL ITEMS 2744 162297.46
Germany For the beach 1824 103317.01
Germany Winter sports 920 58980.45
USA ALL ITEMS 1924 157466.01
USA For the beach 1316 106934.42
USA Winter sports 608 50531.59
Output
Analytic views in Oracle 12.238 12/8/2017
Performance
It’s just SQL
Analytic views in Oracle 12.239 12/8/2017
Rewritten to regular SQL means tuning can use anything that can tune SQL
Indexes
Index Organized Tables
In Memory option
Query Rewrite
– Pre-aggregation with materialized views
SELECT rewrite
Analytic views in Oracle 12.240 12/8/2017
select date_mth_qtr_yr_hier.member_name as month
, amount, amount_prior_period, amount_diff_prior_period
, round(amount_diff_pct_prior_period * 100, 1) as pct
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.level_name = 'MONTH'
order by date_mth_qtr_yr_hier.hier_order;
Query
SELECT rewrite
Analytic views in Oracle 12.240 12/8/2017
select date_mth_qtr_yr_hier.member_name as month
, amount, amount_prior_period, amount_diff_prior_period
, round(amount_diff_pct_prior_period * 100, 1) as pct
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.level_name = 'MONTH'
order by date_mth_qtr_yr_hier.hier_order;
Query
SELECT "A1"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MEMBER_NAME" "MONTH","A1"."MEASURES#AMOUNT" "AMOUNT","A1"."MEASURES#AMOUNT_PR IOR_PER
IOD" "AMOUNT_PRIOR_PERIOD","A1"."MEASURES#AMOUNT_DIFF_PRIOR_PERIOD" "AMOUNT_DIFF_PRIOR_PERIOD",ROUND("A1"."MEASURES#AMOUNT_DI FF_PCT_
PRIOR_PERIOD"*100,1) "PCT" FROM (SELECT "A33"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MEMBER_NAME" "DATE_ATTR_DIM#DATE_MTH_QTR_Y R_HIER#
MEMBER_NAME","A33"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#LEVEL_NAME" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#LEVEL_NAME","A33"."DAT E_ATTR_
DIM#DATE_MTH_QTR_YR_HIER#HIER_ORDER" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#HIER_ORDER","A34"."MEASURES#AMOUNT" "MEASURES#AMOUNT ","A34"
."MEASURES#AMOUNT_PRIOR_PERIOD" "MEASURES#AMOUNT_PRIOR_PERIOD","A34"."MEASURES#AMOUNT_DIFF_PRIOR_PERIOD" "MEASURES#AMOUNT_DIF F_PRIOR
_PERIOD","A34"."MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" "MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" FROM (SELECT "A5"."DATE_ATTR_ DIM#DAT
E_MTH_QTR_YR_HIER#DEPTH$" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DEPTH$","A5"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" "DAT E_ATTR_
DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A5"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_I D","A5"
."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID","A5"."DATE_ATTR_DIM#DATE_MTH_QTR _YR_HIE
R#DATE_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID","A5"."MEASURES#AMOUNT" "MEASURES#AMOUNT","A4"."MEAS$" "MEASURES#AMOUN T_PRIOR
_PERIOD","A3"."MEAS$" "MEASURES#AMOUNT_DIFF_PRIOR_PERIOD","A2"."MEAS$" "MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" FROM (SELECT /*+ NO_
EXPAND */ SUM("SP"."MEASURES#AMOUNT") "MEASURES#AMOUNT","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$"."DATE_ATTR_DIM#DAT E_MTH_Q
TR_YR_HIER#DEPTH$" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DEPTH$","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$"."DATE_ATTR_ DIM#DAT
E_MTH_QTR_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$". "DATE_A
TTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TAR GETS$".
"DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID",CAST(NULL AS date) "DATE_ATTR_DIM #DATE_M
TH_QTR_YR_HIER#DATE_ID" FROM (SELECT /*+ VECTOR_TRANSFORM */ SUM("A14"."AMOUNT") "MEASURES#AMOUNT","A13"."DATE_ATTR_DIM#DATE _MTH_QT
R_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A13"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATT R_DIM#D
ATE_MTH_QTR_YR_HIER#QTR_ID","A13"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" ,CAST(N
ULL AS date) "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID" FROM "AV_USER"."SALES_FACT" "A14", (SELECT "A15"."DATE_ATTR_DIM#DAT E_ID" "
DATE_ATTR_DIM#DATE_ID","A15"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A15 "."DATE
_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","A15"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER# MONTH_I
D" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID",CAST(NULL AS date) "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID" FROM (SELEC T "A16"
."DATE_ATTR_DIM#DATE_ID" "DATE_ATTR_DIM#DATE_ID","A16"."DATE_ATTR_DIM#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" ,"A16".
"DATE_ATTR_DIM#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","A16"."DATE_ATTR_DIM#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR _YR_HIE
R#MONTH_ID" FROM (SELECT "A32"."DATE_ID" "DATE_ATTR_DIM#DATE_ID","A32"."DATE_NAME" "DATE_ATTR_DIM#DATE_NAME","A32"."MONTH_ID " "DATE
_ATTR_DIM#MONTH_ID","A32"."MONTH_NAME" "DATE_ATTR_DIM#MONTH_NAME","A32"."QTR_ID" "DATE_ATTR_DIM#QTR_ID","A32"."QTR_NAME" "DAT E_ATTR_
DIM#QTR_NAME","A32"."CYEAR_ID" "DATE_ATTR_DIM#CYEAR_ID","A32"."CYEAR_NAME" "DATE_ATTR_DIM#CYEAR_NAME","A32"."WEEK_ID" "DATE_A TTR_DIM
#WEEK_ID","A32"."WEEK_NAME" "DATE_ATTR_DIM#WEEK_NAME","A32"."WYEAR_ID" "DATE_ATTR_DIM#WYEAR_ID","A32"."WYEAR_NAME" "DATE_ATTR _DIM#WY
... ... ... ...
... ... ...
... ...
...
DBMS_UTILITY.EXPAND_SQL_TEXT output
SELECT rewrite
Analytic views in Oracle 12.240 12/8/2017
select date_mth_qtr_yr_hier.member_name as month
, amount, amount_prior_period, amount_diff_prior_period
, round(amount_diff_pct_prior_period * 100, 1) as pct
from sales_av hierarchies (
date_mth_qtr_yr_hier
)
where date_mth_qtr_yr_hier.level_name = 'MONTH'
order by date_mth_qtr_yr_hier.hier_order;
Query
SELECT "A1"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MEMBER_NAME" "MONTH","A1"."MEASURES#AMOUNT" "AMOUNT","A1"."MEASURES#AMOUNT_PR IOR_PER
IOD" "AMOUNT_PRIOR_PERIOD","A1"."MEASURES#AMOUNT_DIFF_PRIOR_PERIOD" "AMOUNT_DIFF_PRIOR_PERIOD",ROUND("A1"."MEASURES#AMOUNT_DI FF_PCT_
PRIOR_PERIOD"*100,1) "PCT" FROM (SELECT "A33"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MEMBER_NAME" "DATE_ATTR_DIM#DATE_MTH_QTR_Y R_HIER#
MEMBER_NAME","A33"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#LEVEL_NAME" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#LEVEL_NAME","A33"."DAT E_ATTR_
DIM#DATE_MTH_QTR_YR_HIER#HIER_ORDER" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#HIER_ORDER","A34"."MEASURES#AMOUNT" "MEASURES#AMOUNT ","A34"
."MEASURES#AMOUNT_PRIOR_PERIOD" "MEASURES#AMOUNT_PRIOR_PERIOD","A34"."MEASURES#AMOUNT_DIFF_PRIOR_PERIOD" "MEASURES#AMOUNT_DIF F_PRIOR
_PERIOD","A34"."MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" "MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" FROM (SELECT "A5"."DATE_ATTR_ DIM#DAT
E_MTH_QTR_YR_HIER#DEPTH$" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DEPTH$","A5"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" "DAT E_ATTR_
DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A5"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_I D","A5"
."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID","A5"."DATE_ATTR_DIM#DATE_MTH_QTR _YR_HIE
R#DATE_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID","A5"."MEASURES#AMOUNT" "MEASURES#AMOUNT","A4"."MEAS$" "MEASURES#AMOUN T_PRIOR
_PERIOD","A3"."MEAS$" "MEASURES#AMOUNT_DIFF_PRIOR_PERIOD","A2"."MEAS$" "MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" FROM (SELECT /*+ NO_
EXPAND */ SUM("SP"."MEASURES#AMOUNT") "MEASURES#AMOUNT","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$"."DATE_ATTR_DIM#DAT E_MTH_Q
TR_YR_HIER#DEPTH$" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DEPTH$","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$"."DATE_ATTR_ DIM#DAT
E_MTH_QTR_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$". "DATE_A
TTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TAR GETS$".
"DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID",CAST(NULL AS date) "DATE_ATTR_DIM #DATE_M
TH_QTR_YR_HIER#DATE_ID" FROM (SELECT /*+ VECTOR_TRANSFORM */ SUM("A14"."AMOUNT") "MEASURES#AMOUNT","A13"."DATE_ATTR_DIM#DATE _MTH_QT
R_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A13"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATT R_DIM#D
ATE_MTH_QTR_YR_HIER#QTR_ID","A13"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" ,CAST(N
ULL AS date) "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID" FROM "AV_USER"."SALES_FACT" "A14", (SELECT "A15"."DATE_ATTR_DIM#DAT E_ID" "
DATE_ATTR_DIM#DATE_ID","A15"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A15 "."DATE
_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","A15"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER# MONTH_I
D" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID",CAST(NULL AS date) "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID" FROM (SELEC T "A16"
."DATE_ATTR_DIM#DATE_ID" "DATE_ATTR_DIM#DATE_ID","A16"."DATE_ATTR_DIM#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" ,"A16".
"DATE_ATTR_DIM#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","A16"."DATE_ATTR_DIM#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR _YR_HIE
R#MONTH_ID" FROM (SELECT "A32"."DATE_ID" "DATE_ATTR_DIM#DATE_ID","A32"."DATE_NAME" "DATE_ATTR_DIM#DATE_NAME","A32"."MONTH_ID " "DATE
_ATTR_DIM#MONTH_ID","A32"."MONTH_NAME" "DATE_ATTR_DIM#MONTH_NAME","A32"."QTR_ID" "DATE_ATTR_DIM#QTR_ID","A32"."QTR_NAME" "DAT E_ATTR_
DIM#QTR_NAME","A32"."CYEAR_ID" "DATE_ATTR_DIM#CYEAR_ID","A32"."CYEAR_NAME" "DATE_ATTR_DIM#CYEAR_NAME","A32"."WEEK_ID" "DATE_A TTR_DIM
#WEEK_ID","A32"."WEEK_NAME" "DATE_ATTR_DIM#WEEK_NAME","A32"."WYEAR_ID" "DATE_ATTR_DIM#WYEAR_ID","A32"."WYEAR_NAME" "DATE_ATTR _DIM#WY
... ... ... ...
... ... ...
... ...
...
DBMS_UTILITY.EXPAND_SQL_TEXT output
8289108 BYTES of SQL
ABOUT 8 MB
Materialized views
Analytic views in Oracle 12.241 12/8/2017
create or replace analytic view sales_av
using sales_fact
dimension by ( ((dimension clauses)) )
measures ( ((measure clauses)) )
default measure amount
default aggregate by sum
cache measure group all
levels (date_mth_qtr_yr_hier.month ) materialized
levels (date_wk_yr_hier.week ) materialized
levels (date_mth_season_hier.mthofyr ) materialized
levels (item_category_hier.category ) materialized
levels (customer_group_hier.custgroup ) materialized
levels (customer_state_country_hier.state) materialized
;
Query rewrite on materialized views very useful method to gain performance
Syntax supports making analytic view aware of such materialized views
CACHE syntax
makes SQL
generator of AV
select aware of
mat.views, so it
generates SQL
using the MV's
(Rather than
relying on magic
of normal query
rewrite)
Analytic views in Oracle 12.242 12/8/2017
Classifications
Classifications
Analytic views in Oracle 12.243 12/8/2017
Metadata of dimensions, hierarchies, analytic views, members, attributes, measures
– Caption - either in full classification syntax or shortcut
– Description - either in full classification syntax or shortcut
– Formatting - only in full classification syntax
Can be in multiple languages - only in full classification syntax
Not used in querying with SQL
– But can be queried from dictionary views
Meant for visualization tools
– Classifications available via drivers, for example OLE DB for OLAP Provider
create or replace attribute dimension
item_attr_dim
caption 'Items'
description 'Item attribute dimension'
using item_dim
attributes (
item_id caption 'Item id'
, item_name caption 'Item name'
, category_id caption 'Category id'
, category_name caption 'Category name'
)
level item
caption 'Item'
description 'Items in product catalogue'
key item_id
alternate key item_name
member name item_name
member caption item_name
order by item_name
determines (category_id)
level category
caption 'Item category'
description 'Categorization of items'
key category_id
alternate key category_name
member name category_name
member caption category_name
order by category_name
all
member name 'ALL ITEMS'
member caption 'All items'
member description ‘All items in catalogue'
Caption and Description shortcuts
Analytic views in Oracle 12.244 12/8/2017
Attribute dimension
create or replace attribute dimension
item_attr_dim
caption 'Items'
description 'Item attribute dimension'
using item_dim
attributes (
item_id caption 'Item id'
, item_name caption 'Item name'
, category_id caption 'Category id'
, category_name caption 'Category name'
)
level item
caption 'Item'
description 'Items in product catalogue'
key item_id
alternate key item_name
member name item_name
member caption item_name
order by item_name
determines (category_id)
level category
caption 'Item category'
description 'Categorization of items'
key category_id
alternate key category_name
member name category_name
member caption category_name
order by category_name
all
member name 'ALL ITEMS'
member caption 'All items'
member description ‘All items in catalogue'
Caption and Description shortcuts
Analytic views in Oracle 12.244 12/8/2017
Attribute dimension
create or replace hierarchy date_mth_qtr_yr_hier
caption 'D/M/Q/Y Hierarchy'
description 'Hierarchy day-month-quarter-year'
using date_attr_dim
(
day
child of month
child of quarter
child of cyear
);
Hierarchy
create or replace attribute dimension
item_attr_dim
caption 'Items'
description 'Item attribute dimension'
using item_dim
attributes (
item_id caption 'Item id'
, item_name caption 'Item name'
, category_id caption 'Category id'
, category_name caption 'Category name'
)
level item
caption 'Item'
description 'Items in product catalogue'
key item_id
alternate key item_name
member name item_name
member caption item_name
order by item_name
determines (category_id)
level category
caption 'Item category'
description 'Categorization of items'
key category_id
alternate key category_name
member name category_name
member caption category_name
order by category_name
all
member name 'ALL ITEMS'
member caption 'All items'
member description ‘All items in catalogue'
Caption and Description shortcuts
Analytic views in Oracle 12.244 12/8/2017
Attribute dimension
create or replace hierarchy date_mth_qtr_yr_hier
caption 'D/M/Q/Y Hierarchy'
description 'Hierarchy day-month-quarter-year'
using date_attr_dim
(
day
child of month
child of quarter
child of cyear
);
Hierarchy
create or replace analytic view sales_av
caption 'Sales analysis'
description 'Analysis of sales by date, item and customer hierarchies'
using sales_fact
dimension by (
date_attr_dim
caption 'Sales date dimension'
description 'Date hierarchies for date of sales'
key sales_date
...
measures (
qty fact qty
caption 'Quantity'
description 'Sold quantity of items'
, amount fact amount
caption 'Amount'
description 'Total amount for the sold items'
...
Analytic view
create or replace analytic view sales_av
classification caption value 'Sales analysis'
classification description value 'Analysis of sales by date, item and customer hierarchies'
using sales_fact
dimension by (
date_attr_dim
classification caption value 'Sales date dimension'
classification description value 'Date hierarchies for date of sales'
classification my_own_class value 'My own dimension classification'
key sales_date
references date_id
hierarchies (
...
/*
my_own_class is user-defined classification, may be used by own application
*/
Classification long syntax
Analytic views in Oracle 12.245 12/8/2017
Basic classifications
create or replace analytic view sales_av
classification caption value 'Sales analysis'
classification description value 'Analysis of sales by date, item and customer hierarchies'
using sales_fact
dimension by (
date_attr_dim
classification caption value 'Sales date dimension'
classification description value 'Date hierarchies for date of sales'
classification my_own_class value 'My own dimension classification'
key sales_date
references date_id
hierarchies (
...
/*
my_own_class is user-defined classification, may be used by own application
*/
Classification long syntax
Analytic views in Oracle 12.245 12/8/2017
Basic classifications
...
measures (
qty fact qty
classification caption value 'Quantity'
classification description value 'Sold quantity of items'
classification format_string value '9,999'
classification fore_color value '#FF0000'
, amount fact amount
classification caption value 'Amount'
classification description value 'Total amount for the sold items'
classification format_string value '$99,999.99'
classification back_color value '#00FF00'
...
Formatting
create or replace analytic view sales_av
classification caption value 'Sales analysis'
classification description value 'Analysis of sales by date, item and customer hierarchies'
using sales_fact
dimension by (
date_attr_dim
classification caption value 'Sales date dimension'
classification description value 'Date hierarchies for date of sales'
classification my_own_class value 'My own dimension classification'
key sales_date
references date_id
hierarchies (
...
/*
my_own_class is user-defined classification, may be used by own application
*/
Classification long syntax
Analytic views in Oracle 12.245 12/8/2017
Basic classifications
...
measures (
qty fact qty
classification caption value 'Quantity'
classification description value 'Sold quantity of items'
classification format_string value '9,999'
classification fore_color value '#FF0000'
, amount fact amount
classification caption value 'Amount'
classification description value 'Total amount for the sold items'
classification format_string value '$99,999.99'
classification back_color value '#00FF00'
...
Formatting
create or replace attribute dimension item_attr_dim
dimension type standard
classification caption value 'Items'
classification caption value 'Produkte' language 'GERMAN'
classification caption value 'Varer' language 'DANISH'
classification description value 'Item attribute dimension'
classification description value 'Produkt Attribut Dimension' language 'GERMAN'
classification description value 'Vare attribut dimension' language 'DANISH'
using item_dim
attributes (
...
/*
Not specifying language means "Default" language, which the application may
choose to pick if a classification in the specific name is not available
*/
Languages
Analytic views in Oracle 12.246 12/8/2017
Summary
Summary
Analytic views in Oracle 12.247 12/8/2017
Analytic views allow dimensional analysis of data
– On real-time data
– Without copying data to datawarehouse and cube
– Without writing complex analytic SQL in individual queries
(complexity hidden in metadata allowing analysis queries to be simpler)
“Standard” SQL tuning methods apply
Metadata can be enriched with classifications for tool use
(OLAP drivers can view the analytic views similar to a cube)
Analytic views in Oracle 12.248 12/8/2017
Links
This presentation PowerPoint http://bit.ly/kibeha_av122_pptx
Script with all examples from this presentation http://bit.ly/kibeha_av122_sql
Questions & Answers
Kim Berg Hansen
Senior Consultant
kim.berghansen@trivadis.com
12/8/2017 Analytic views in Oracle 12.249
http://bit.ly/kibeha_av122_pptx
http://bit.ly/kibeha_av122_sql

More Related Content

What's hot

20894109 te040-i procurement-test-script-on-oracle-iprocurement
20894109 te040-i procurement-test-script-on-oracle-iprocurement20894109 te040-i procurement-test-script-on-oracle-iprocurement
20894109 te040-i procurement-test-script-on-oracle-iprocurement
Pietro Prestia
 
Project Management System
Project Management SystemProject Management System
Project Management System
Divyen Patel
 
Oracle Inventory r12 lot and serial control.ppt
Oracle Inventory r12 lot and serial control.pptOracle Inventory r12 lot and serial control.ppt
Oracle Inventory r12 lot and serial control.ppt
ahosainy
 
Oracle Eam Implementation Steps For Oracle E Am Module
Oracle Eam   Implementation Steps For Oracle E Am ModuleOracle Eam   Implementation Steps For Oracle E Am Module
Oracle Eam Implementation Steps For Oracle E Am Module
applearn
 
Ame concepts
Ame conceptsAme concepts
Ame concepts
cstath
 
Business Requirements Document Template
Business Requirements Document TemplateBusiness Requirements Document Template
Business Requirements Document Template
Edmond Cheng
 

What's hot (20)

Projeto Brazil Ri
Projeto Brazil  RiProjeto Brazil  Ri
Projeto Brazil Ri
 
Basics of Oracle Purchasing
Basics of Oracle PurchasingBasics of Oracle Purchasing
Basics of Oracle Purchasing
 
Oracle fixed assets
Oracle fixed assetsOracle fixed assets
Oracle fixed assets
 
Oracle i procurement
Oracle i procurementOracle i procurement
Oracle i procurement
 
20894109 te040-i procurement-test-script-on-oracle-iprocurement
20894109 te040-i procurement-test-script-on-oracle-iprocurement20894109 te040-i procurement-test-script-on-oracle-iprocurement
20894109 te040-i procurement-test-script-on-oracle-iprocurement
 
Oracle ame complete setup
Oracle ame complete setupOracle ame complete setup
Oracle ame complete setup
 
Customizing Oracle EBS OA Framework
Customizing Oracle EBS OA FrameworkCustomizing Oracle EBS OA Framework
Customizing Oracle EBS OA Framework
 
Surendra Beniwal Oracle Applications Consultant Resume
Surendra Beniwal Oracle Applications Consultant ResumeSurendra Beniwal Oracle Applications Consultant Resume
Surendra Beniwal Oracle Applications Consultant Resume
 
Project Management System
Project Management SystemProject Management System
Project Management System
 
R12 Fixed Assets General Questions
R12 Fixed Assets General QuestionsR12 Fixed Assets General Questions
R12 Fixed Assets General Questions
 
Oracle R12 Apps – SCM Functional Interview Questions & Answers – Purchasing M...
Oracle R12 Apps – SCM Functional Interview Questions & Answers – Purchasing M...Oracle R12 Apps – SCM Functional Interview Questions & Answers – Purchasing M...
Oracle R12 Apps – SCM Functional Interview Questions & Answers – Purchasing M...
 
R12 inventory features
R12 inventory featuresR12 inventory features
R12 inventory features
 
Oracle Inventory r12 lot and serial control.ppt
Oracle Inventory r12 lot and serial control.pptOracle Inventory r12 lot and serial control.ppt
Oracle Inventory r12 lot and serial control.ppt
 
Oracle Eam Implementation Steps For Oracle E Am Module
Oracle Eam   Implementation Steps For Oracle E Am ModuleOracle Eam   Implementation Steps For Oracle E Am Module
Oracle Eam Implementation Steps For Oracle E Am Module
 
Ame concepts
Ame conceptsAme concepts
Ame concepts
 
Oracle Quality setup
Oracle Quality setupOracle Quality setup
Oracle Quality setup
 
Oracle Receivables R12
Oracle Receivables R12Oracle Receivables R12
Oracle Receivables R12
 
Business Requirements Document Template
Business Requirements Document TemplateBusiness Requirements Document Template
Business Requirements Document Template
 
Database administration and security
Database administration and securityDatabase administration and security
Database administration and security
 
Oracle R12 Multi org ivas
Oracle R12 Multi org ivasOracle R12 Multi org ivas
Oracle R12 Multi org ivas
 

Similar to Analytic Views in Oracle 12.2

Similar to Analytic Views in Oracle 12.2 (20)

Physical Design and Development
Physical Design and DevelopmentPhysical Design and Development
Physical Design and Development
 
MIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome MeasuresMIS5101 WK10 Outcome Measures
MIS5101 WK10 Outcome Measures
 
Graph db as metastore
Graph db as metastoreGraph db as metastore
Graph db as metastore
 
RDBMS to NoSQL: Practical Advice from Successful Migrations
RDBMS to NoSQL: Practical Advice from Successful MigrationsRDBMS to NoSQL: Practical Advice from Successful Migrations
RDBMS to NoSQL: Practical Advice from Successful Migrations
 
SQL Server Denali: BI on Your Terms
SQL Server Denali: BI on Your Terms SQL Server Denali: BI on Your Terms
SQL Server Denali: BI on Your Terms
 
Big data technology unit 3
Big data technology unit 3Big data technology unit 3
Big data technology unit 3
 
No sql bigdata and postgresql
No sql bigdata and postgresqlNo sql bigdata and postgresql
No sql bigdata and postgresql
 
NoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to CouchbaseNoSQL - A Closer Look to Couchbase
NoSQL - A Closer Look to Couchbase
 
MySQL Document Store for Modern Applications
MySQL Document Store for Modern ApplicationsMySQL Document Store for Modern Applications
MySQL Document Store for Modern Applications
 
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
 
SQL for NoSQL and how Apache Calcite can help
SQL for NoSQL and how  Apache Calcite can helpSQL for NoSQL and how  Apache Calcite can help
SQL for NoSQL and how Apache Calcite can help
 
Data modeling star schema
Data modeling star schemaData modeling star schema
Data modeling star schema
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
 
Be a database professional
Be a database professionalBe a database professional
Be a database professional
 
معرفی کاربردهای یادگیری عمیق و چالش های آن در کلان داده
معرفی کاربردهای یادگیری عمیق و چالش های آن در کلان دادهمعرفی کاربردهای یادگیری عمیق و چالش های آن در کلان داده
معرفی کاربردهای یادگیری عمیق و چالش های آن در کلان داده
 
Jdbc Dao it-slideshares.blogspot.com
Jdbc Dao it-slideshares.blogspot.comJdbc Dao it-slideshares.blogspot.com
Jdbc Dao it-slideshares.blogspot.com
 
No SQL and MongoDB - Hyderabad Scalability Meetup
No SQL and MongoDB - Hyderabad Scalability MeetupNo SQL and MongoDB - Hyderabad Scalability Meetup
No SQL and MongoDB - Hyderabad Scalability Meetup
 
Data Modeling with Neo4j
Data Modeling with Neo4jData Modeling with Neo4j
Data Modeling with Neo4j
 
Analysis Services en SQL Server 2008
Analysis Services en SQL Server 2008Analysis Services en SQL Server 2008
Analysis Services en SQL Server 2008
 
MongoDB Knowledge share
MongoDB Knowledge shareMongoDB Knowledge share
MongoDB Knowledge share
 

More from Kim Berg Hansen

More from Kim Berg Hansen (10)

External Tables - not just loading a csv file
External Tables - not just loading a csv fileExternal Tables - not just loading a csv file
External Tables - not just loading a csv file
 
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
When 7 bit-ascii ain't enough - about NLS, collation, charsets, unicode and s...
 
When 7-bit ASCII ain't enough - about NLS, Collation, Charsets, Unicode and such
When 7-bit ASCII ain't enough - about NLS, Collation, Charsets, Unicode and suchWhen 7-bit ASCII ain't enough - about NLS, Collation, Charsets, Unicode and such
When 7-bit ASCII ain't enough - about NLS, Collation, Charsets, Unicode and such
 
Uses of row pattern matching
Uses of row pattern matchingUses of row pattern matching
Uses of row pattern matching
 
Read, store and create xml and json
Read, store and create xml and jsonRead, store and create xml and json
Read, store and create xml and json
 
Data twisting
Data twistingData twisting
Data twisting
 
Oracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web ServicesOracle database - Get external data via HTTP, FTP and Web Services
Oracle database - Get external data via HTTP, FTP and Web Services
 
Oracle database - Analytic functions - Advanced cases
Oracle database - Analytic functions - Advanced casesOracle database - Analytic functions - Advanced cases
Oracle database - Analytic functions - Advanced cases
 
Real cases of indispensability of Oracle SQL analytic functions
Real cases of indispensability of Oracle SQL analytic functionsReal cases of indispensability of Oracle SQL analytic functions
Real cases of indispensability of Oracle SQL analytic functions
 
Really using Oracle analytic SQL functions
Really using Oracle analytic SQL functionsReally using Oracle analytic SQL functions
Really using Oracle analytic SQL functions
 

Recently uploaded

Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
gajnagarg
 
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
HyderabadDolls
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
nirzagarg
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
Abortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Doha {{ QATAR }} +966572737505) Get CytotecAbortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 

Recently uploaded (20)

Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbers
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
 
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
 
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Abortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Doha {{ QATAR }} +966572737505) Get CytotecAbortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
Abortion pills in Doha {{ QATAR }} +966572737505) Get Cytotec
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
 

Analytic Views in Oracle 12.2

  • 1. BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF HAMBURG KOPENHAGEN LAUSANNE MÜNCHEN STUTTGART WIEN ZÜRICH Analytic views in Oracle 12.2 The virtual cube Kim Berg Hansen Senior Consultant
  • 2. About me Analytic views in Oracle 12.22 12/8/2017 • Danish geek • SQL & PL/SQL developer since 2000 • Developer at Trivadis AG since 2016 http://www.trivadis.dk • Oracle Certified Expert in SQL • Oracle ACE • Blogger at http://www.kibeha.dk • SQL quizmaster at http://devgym.oracle.com • Likes to cook • Reads sci-fi • Member of Danish Beer Enthusiasts
  • 3. 3 Membership Tiers • Oracle ACE Director • Oracle ACE • Oracle ACE Associate bit.ly/OracleACEProgram 500+ Technical Experts Helping Peers Globally Connect: Nominate yourself or someone you know: acenomination.oracle.com @oracleace Facebook.com/oracleaces oracle-ace_ww@oracle.com
  • 4. About Trivadis Analytic views in Oracle 12.24 12/8/2017 Trivadis is a market leader in IT consulting, system integration, solution engineering and the provision of IT services focusing on and technologies in Switzerland, Germany, Austria and Denmark. We offer our services in the following strategic business fields: Trivadis Services takes over the interacting operation of your IT systems. O P E R A T I O N
  • 5. COPENHAGEN MUNICH LAUSANNE BERN ZURICH BRUGG GENEVA HAMBURG DÜSSELDORF FRANKFURT STUTTGART FREIBURG BASEL VIENNA With over 600 specialists and IT experts in your region Analytic views in Oracle 12.25 12/8/2017 14 Trivadis branches and more than 600 employees 260 Service Level Agreements Over 4,000 training participants Research and development budget: EUR 5.0 million Financially self-supporting and sustainably profitable Experience from more than 1,900 projects per year at over 800 customers
  • 6. Analytic Views in Oracle 12.2 - Agenda Analytic views in Oracle 12.26 12/8/2017 1. Concepts 2. ATTRIBUTE DIMENSION 3. HIERARCHY 4. ANALYTIC VIEW 5. Querying with SQL 6. Performance 7. Classifications 8. Summary
  • 7. Analytic views in Oracle 12.27 12/8/2017 Concepts
  • 8. Like a view – but dimensional Analytic views in Oracle 12.28 12/8/2017 Reports View SQL RelationalMetadataRelational Query
  • 9. Like a view – but dimensional Analytic views in Oracle 12.28 12/8/2017 Reports View SQL RelationalMetadataRelational Query Reports Analytic View SQL (expanded) DimensionalMetadataRelational Query
  • 10. Virtual Like a view – but dimensional Analytic views in Oracle 12.28 12/8/2017 Reports View SQL RelationalMetadataRelational Query Reports Analytic View SQL (expanded) DimensionalMetadataRelational Query
  • 11. Like a dimensional OLAP cube – but virtual Analytic views in Oracle 12.29 12/8/2017 Reports Copy MDX DatawarehouseETLRelational Query Copy Build Cube
  • 12. Virtual (not copying data) Like a dimensional OLAP cube – but virtual Analytic views in Oracle 12.29 12/8/2017 Reports Copy MDX DatawarehouseETLRelational Query Reports Analytic View SQL (expanded) DimensionalMetadataRelational Query Copy Build Cube
  • 13. (m)view join join join Anatomy of Analytic View: Metadata object types Analytic views in Oracle 12.210 12/8/2017 Dimension Table Tables+view (Materialized?) Fact Table Relational Relational
  • 14. (m)view join join join Virtual (not copying data) Anatomy of Analytic View: Metadata object types Analytic views in Oracle 12.210 12/8/2017 Dimension Table Tables+view (Materialized?) Fact Table Attribute Dimension Attr. Dimension Definition of: - Attributes - Levels - Member keys - Member names Attr. Dimension Definition of: - Attributes - Levels - Member keys - Member names Relational Relational
  • 15. (m)view join join join Virtual (not copying data) Anatomy of Analytic View: Metadata object types Analytic views in Oracle 12.210 12/8/2017 Dimension Table Tables+view (Materialized?) Fact Table Attribute Dimension Hierarchy Attr. Dimension Definition of: - Attributes - Levels - Member keys - Member names Attr. Dimension Definition of: - Attributes - Levels - Member keys - Member names Hierarchy Definition of: Parent-Child relations of attr.dim. levels Hierarchy Definition of: Parent-Child relations of attr.dim. levels Hierarchy Definition of: Parent-Child relations of attr.dim. levels Relational Relational
  • 16. (m)view join join join Virtual (not copying data) Anatomy of Analytic View: Metadata object types Analytic views in Oracle 12.210 12/8/2017 Dimension Table Tables+view (Materialized?) Fact Table Attribute Dimension Hierarchy Analytic View Attr. Dimension Definition of: - Attributes - Levels - Member keys - Member names Attr. Dimension Definition of: - Attributes - Levels - Member keys - Member names Hierarchy Definition of: Parent-Child relations of attr.dim. levels Hierarchy Definition of: Parent-Child relations of attr.dim. levels Hierarchy Definition of: Parent-Child relations of attr.dim. levels Analytic view Definition of: - Fact<->Dimensions relationships - Available hierarchies - Fact measures - Calculated measures - Aggregates to use Relational Relational
  • 17. (m)view join join join Virtual (not copying data) Anatomy of Analytic View: Metadata object types Analytic views in Oracle 12.210 12/8/2017 Dimension Table SQL (expanded) Tables+view (Materialized?) Fact Table Attribute Dimension Hierarchy Analytic View Attr. Dimension Definition of: - Attributes - Levels - Member keys - Member names Attr. Dimension Definition of: - Attributes - Levels - Member keys - Member names Hierarchy Definition of: Parent-Child relations of attr.dim. levels Hierarchy Definition of: Parent-Child relations of attr.dim. levels Hierarchy Definition of: Parent-Child relations of attr.dim. levels Analytic view Definition of: - Fact<->Dimensions relationships - Available hierarchies - Fact measures - Calculated measures - Aggregates to use Relational Relational
  • 18. 12.2 Application Containers Analytic views in Oracle 12.211 12/8/2017 SHARE WITH clause is available for the object types – Attribute dimensions – Hierarchies – Analytic views Allows the objects to be shared across application containers Sharing can be either – NONE - share nothing (default) – METADATA - share metadata (definition) only – OBJECT - share entire object, both metadata as well as data
  • 19. Analytic views in Oracle 12.212 12/8/2017 ATTRIBUTE DIMENSION
  • 20. ATTRIBUTE DIMENSION Analytic views in Oracle 12.213 12/8/2017 Metadata – not storing values. Values stay in base table(s) Based on a regular table with dimension values Or multiple tables joined and denormalized: – via regular view – or via materialized view Defining all possible member attributes of the dimension Defining all possible levels of the dimension: – which attributes are keys, alternate keys, names and ordering – which attributes determine other attributes
  • 21. ATTRIBUTE DIMENSION - Standard Analytic views in Oracle 12.214 12/8/2017 create table item_dim ( item_id integer primary key , item_name varchar2(20) not null unique , category_id integer not null , category_name varchar2(20) not null ); Denormalized dimension table
  • 22. ATTRIBUTE DIMENSION - Standard Analytic views in Oracle 12.214 12/8/2017 create table item_dim ( item_id integer primary key , item_name varchar2(20) not null unique , category_id integer not null , category_name varchar2(20) not null ); Denormalized dimension table create or replace attribute dimension item_attr_dim dimension type standard using item_dim attributes ( item_id, item_name, category_id, category_name ) level item key item_id member name item_name order by item_name determines (category_id) level category key category_id member name category_name order by category_name all member name 'ALL ITEMS'; Attribute dimension
  • 23. create table country_dim ( country_id integer primary key , country_name varchar2(20) not null ); create table state_dim ( state_id integer primary key , state_name varchar2(20) not null , country_id integer not null references country_dim ); create table custgroup_dim ( custgroup_id integer primary key , custgroup_name varchar2(20) not null ); create table customer_dim ( customer_id integer primary key , customer_name varchar2(20) not null , state_id integer not null references state_dim , custgroup_id integer not null references custgroup_dim ); ATTRIBUTE DIMENSION – Branched levels Analytic views in Oracle 12.215 12/8/2017 Normalized dimension tables
  • 24. create table country_dim ( country_id integer primary key , country_name varchar2(20) not null ); create table state_dim ( state_id integer primary key , state_name varchar2(20) not null , country_id integer not null references country_dim ); create table custgroup_dim ( custgroup_id integer primary key , custgroup_name varchar2(20) not null ); create table customer_dim ( customer_id integer primary key , customer_name varchar2(20) not null , state_id integer not null references state_dim , custgroup_id integer not null references custgroup_dim ); ATTRIBUTE DIMENSION – Branched levels Analytic views in Oracle 12.215 12/8/2017 Normalized dimension tables create or replace view customer_dim_view as select c.customer_id , c.customer_name , cg.custgroup_id , cg.custgroup_name , s.state_id , s.state_name , co.country_id , co.country_name from customer_dim c join custgroup_dim cg on cg.custgroup_id = c.custgroup_id join state_dim s on s.state_id = c.state_id join country_dim co on co.country_id = s.country_id; /* Could be materialized view – periodic or ON COMMIT refresh */ Denormalized dimension view
  • 25. create table country_dim ( country_id integer primary key , country_name varchar2(20) not null ); create table state_dim ( state_id integer primary key , state_name varchar2(20) not null , country_id integer not null references country_dim ); create table custgroup_dim ( custgroup_id integer primary key , custgroup_name varchar2(20) not null ); create table customer_dim ( customer_id integer primary key , customer_name varchar2(20) not null , state_id integer not null references state_dim , custgroup_id integer not null references custgroup_dim ); ATTRIBUTE DIMENSION – Branched levels Analytic views in Oracle 12.215 12/8/2017 Normalized dimension tables create or replace view customer_dim_view as select c.customer_id , c.customer_name , cg.custgroup_id , cg.custgroup_name , s.state_id , s.state_name , co.country_id , co.country_name from customer_dim c join custgroup_dim cg on cg.custgroup_id = c.custgroup_id join state_dim s on s.state_id = c.state_id join country_dim co on co.country_id = s.country_id; /* Could be materialized view – periodic or ON COMMIT refresh */ Denormalized dimension view create or replace attribute dimension customer_attr_dim using customer_dim_view attributes ( customer_id, customer_name, custgroup_id, custgroup_name , state_id , state_name , country_id , country_name ) level customer key customer_id member name customer_name determines (custgroup_id, state_id) level custgroup key custgroup_id member name custgroup_name level state key state_id member name state_name determines (country_id) level country key country_id member name country_name all member name 'ALL CUSTOMERS'; Attribute dimension
  • 26. create table date_dim ( date_id date primary key , date_name varchar2(10) not null unique , month_id integer not null , month_name varchar2(10) not null , qtr_id integer not null , qtr_name varchar2(10) not null , year_id integer not null , year_name varchar2(4) not null , mthofyr_id integer not null , mthofyr_name varchar2(3) not null , season_id integer not null , season_name varchar2(10) not null ); ATTRIBUTE DIMENSION – Dimension type TIME Analytic views in Oracle 12.216 12/8/2017 Dimension table
  • 27. create table date_dim ( date_id date primary key , date_name varchar2(10) not null unique , month_id integer not null , month_name varchar2(10) not null , qtr_id integer not null , qtr_name varchar2(10) not null , year_id integer not null , year_name varchar2(4) not null , mthofyr_id integer not null , mthofyr_name varchar2(3) not null , season_id integer not null , season_name varchar2(10) not null ); ATTRIBUTE DIMENSION – Dimension type TIME Analytic views in Oracle 12.216 12/8/2017 Dimension table insert into date_dim select date_date as date_id , to_char(date_date,'YYYY-MM-DD') date_name , to_number(to_char(date_date,'YYYYMM')) month_id, to_char(date_date,'YYYY-MM') month_name , to_number(to_char(date_date,'YYYYQ')) qtr_id , to_char(date_date,'YYYY-"Q"Q') qtr_name , to_number(to_char(date_date,'YYYY')) year_id , to_char(date_date,'YYYY') year_name , extract(month from date_date) mthofyr_id , to_char(date_date,'FMMon' , 'nls_date_language=american') mthofyr_name , case when extract(month from date_date) in (12,1,2) then 1 when extract(month from date_date) in (3,4,5 ) then 2 when extract(month from date_date) in (6,7,8 ) then 3 when extract(month from date_date) in (9,10,11) then 4 end season_id , case when extract(month from date_date) in (12,1,2) then 'Winter' when extract(month from date_date) in (3,4,5 ) then 'Spring' when extract(month from date_date) in (6,7,8 ) then 'Summer' when extract(month from date_date) in (9,10,11) then 'Fall' end season_name from ( select date '2014-01-01' + level - 1 date_date from dual connect by level <= date '2017-12-31' - date '2014-01-01' + 1 ) order by date_id; Populate table
  • 28. create table date_dim ( date_id date primary key , date_name varchar2(10) not null unique , month_id integer not null , month_name varchar2(10) not null , qtr_id integer not null , qtr_name varchar2(10) not null , year_id integer not null , year_name varchar2(4) not null , mthofyr_id integer not null , mthofyr_name varchar2(3) not null , season_id integer not null , season_name varchar2(10) not null ); ATTRIBUTE DIMENSION – Dimension type TIME Analytic views in Oracle 12.216 12/8/2017 Dimension table insert into date_dim select date_date as date_id , to_char(date_date,'YYYY-MM-DD') date_name , to_number(to_char(date_date,'YYYYMM')) month_id, to_char(date_date,'YYYY-MM') month_name , to_number(to_char(date_date,'YYYYQ')) qtr_id , to_char(date_date,'YYYY-"Q"Q') qtr_name , to_number(to_char(date_date,'YYYY')) year_id , to_char(date_date,'YYYY') year_name , extract(month from date_date) mthofyr_id , to_char(date_date,'FMMon' , 'nls_date_language=american') mthofyr_name , case when extract(month from date_date) in (12,1,2) then 1 when extract(month from date_date) in (3,4,5 ) then 2 when extract(month from date_date) in (6,7,8 ) then 3 when extract(month from date_date) in (9,10,11) then 4 end season_id , case when extract(month from date_date) in (12,1,2) then 'Winter' when extract(month from date_date) in (3,4,5 ) then 'Spring' when extract(month from date_date) in (6,7,8 ) then 'Summer' when extract(month from date_date) in (9,10,11) then 'Fall' end season_name from ( select date '2014-01-01' + level - 1 date_date from dual connect by level <= date '2017-12-31' - date '2014-01-01' + 1 ) order by date_id; Populate table create or replace attribute dimension date_attr_dim dimension type time using date_dim attributes ( date_id , date_name , month_id , month_name , qtr_id , qtr_name , year_id , year_name , mthofyr_id , mthofyr_name , season_id , season_name ) level day level type days key date_id member name date_name order by date_id determines (month_id, mthofyr_id) level month level type months key month_id member name month_name order by month_id determines (qtr_id, mthofyr_id) level quarter level type quarters key qtr_id member name qtr_name order by qtr_id determines (year_id) level year level type years key year_id member name year_name order by year_id level mthofyr level type months key mthofyr_id member name mthofyr_name order by mthofyr_id determines (season_id) level season level type quarters key season_id member name season_name order by season_id all member name 'ALL DATES'; Attribute dimension
  • 29. Analytic views in Oracle 12.217 12/8/2017 HIERARCHY
  • 30. HIERARCHY Analytic views in Oracle 12.218 12/8/2017 Metadata – not storing values. Values stay in base table(s) Based on attribute dimension Defining parent->child relations for the levels of a dimension Multiple hierarchies may exist for one dimension Generates virtual columns and rows for the hierarchy Is a row source – you can SELECT from a hierarchy
  • 31. HIERARCHY - Single Analytic views in Oracle 12.219 12/8/2017 create or replace attribute dimension item_attr_dim dimension type standard using item_dim attributes ( item_id, item_name, category_id, category_name ) level item key item_id member name item_name order by item_name determines (category_id) level category key category_id member name category_name order by category_name all member name 'ALL ITEMS'; Attribute dimension
  • 32. HIERARCHY - Single Analytic views in Oracle 12.219 12/8/2017 create or replace attribute dimension item_attr_dim dimension type standard using item_dim attributes ( item_id, item_name, category_id, category_name ) level item key item_id member name item_name order by item_name determines (category_id) level category key category_id member name category_name order by category_name all member name 'ALL ITEMS'; Attribute dimension create or replace hierarchy item_category_hier using item_attr_dim ( item child of category ); Hierarchy
  • 33. Columns of a hierarchy Analytic views in Oracle 12.220 12/8/2017 ITEM_ID ITEM_NAME CATEGORY_ID CATEGORY_NAME MEMBER_NAME MEMBER_UNIQUE_NAME MEMBER_CAPTION MEMBER_DESCRIPTION LEVEL_NAME HIER_ORDER DEPTH IS_LEAF PARENT_LEVEL_NAME PARENT_UNIQUE_NAME Dimension attribute columns / rows + generated hierarchical columns / rows
  • 34. Columns of a hierarchy Analytic views in Oracle 12.220 12/8/2017 ITEM_ID ITEM_NAME CATEGORY_ID CATEGORY_NAME MEMBER_NAME MEMBER_UNIQUE_NAME MEMBER_CAPTION MEMBER_DESCRIPTION LEVEL_NAME HIER_ORDER DEPTH IS_LEAF PARENT_LEVEL_NAME PARENT_UNIQUE_NAME Dimension attribute columns / rows + generated hierarchical columns / rows 230 Bikini 2 For the beach Bikini [ITEM].&[230] ITEM 2 2 1 CATEGORY [CATEGORY].&[2]
  • 35. Columns of a hierarchy Analytic views in Oracle 12.220 12/8/2017 ITEM_ID ITEM_NAME CATEGORY_ID CATEGORY_NAME MEMBER_NAME MEMBER_UNIQUE_NAME MEMBER_CAPTION MEMBER_DESCRIPTION LEVEL_NAME HIER_ORDER DEPTH IS_LEAF PARENT_LEVEL_NAME PARENT_UNIQUE_NAME Dimension attribute columns / rows + generated hierarchical columns / rows 230 Bikini 2 For the beach Bikini [ITEM].&[230] ITEM 2 2 1 CATEGORY [CATEGORY].&[2] 2 For the beach For the beach [CATEGORY].&[2] CATEGORY 1 1 0 ALL [ALL].[ALL ITEMS]
  • 36. Columns of a hierarchy Analytic views in Oracle 12.220 12/8/2017 ITEM_ID ITEM_NAME CATEGORY_ID CATEGORY_NAME MEMBER_NAME MEMBER_UNIQUE_NAME MEMBER_CAPTION MEMBER_DESCRIPTION LEVEL_NAME HIER_ORDER DEPTH IS_LEAF PARENT_LEVEL_NAME PARENT_UNIQUE_NAME Dimension attribute columns / rows + generated hierarchical columns / rows 230 Bikini 2 For the beach Bikini [ITEM].&[230] ITEM 2 2 1 CATEGORY [CATEGORY].&[2] 2 For the beach For the beach [CATEGORY].&[2] CATEGORY 1 1 0 ALL [ALL].[ALL ITEMS] 130 Bob sled 1 Winter sports Bob sled [ITEM].&[130] ITEM 7 2 1 CATEGORY [CATEGORY].&[1]
  • 37. Columns of a hierarchy Analytic views in Oracle 12.220 12/8/2017 ITEM_ID ITEM_NAME CATEGORY_ID CATEGORY_NAME MEMBER_NAME MEMBER_UNIQUE_NAME MEMBER_CAPTION MEMBER_DESCRIPTION LEVEL_NAME HIER_ORDER DEPTH IS_LEAF PARENT_LEVEL_NAME PARENT_UNIQUE_NAME Dimension attribute columns / rows + generated hierarchical columns / rows 230 Bikini 2 For the beach Bikini [ITEM].&[230] ITEM 2 2 1 CATEGORY [CATEGORY].&[2] 2 For the beach For the beach [CATEGORY].&[2] CATEGORY 1 1 0 ALL [ALL].[ALL ITEMS] 130 Bob sled 1 Winter sports Bob sled [ITEM].&[130] ITEM 7 2 1 CATEGORY [CATEGORY].&[1] 1 Winter sports Winter sports [CATEGORY].&[1] CATEGORY 6 1 0 ALL [ALL].[ALL ITEMS]
  • 38. Columns of a hierarchy Analytic views in Oracle 12.220 12/8/2017 ITEM_ID ITEM_NAME CATEGORY_ID CATEGORY_NAME MEMBER_NAME MEMBER_UNIQUE_NAME MEMBER_CAPTION MEMBER_DESCRIPTION LEVEL_NAME HIER_ORDER DEPTH IS_LEAF PARENT_LEVEL_NAME PARENT_UNIQUE_NAME Dimension attribute columns / rows + generated hierarchical columns / rows 230 Bikini 2 For the beach Bikini [ITEM].&[230] ITEM 2 2 1 CATEGORY [CATEGORY].&[2] 2 For the beach For the beach [CATEGORY].&[2] CATEGORY 1 1 0 ALL [ALL].[ALL ITEMS] 130 Bob sled 1 Winter sports Bob sled [ITEM].&[130] ITEM 7 2 1 CATEGORY [CATEGORY].&[1] 1 Winter sports Winter sports [CATEGORY].&[1] CATEGORY 6 1 0 ALL [ALL].[ALL ITEMS] ALL ITEMS [ALL].[ALL ITEMS] ALL 0 0 0
  • 39. Hierarchy tree Analytic views in Oracle 12.221 12/8/2017 select hier_order , lpad(' ', depth * 2) || case is_leaf when 0 then '+ ' else '- ' end || member_name as tree , member_unique_name from item_category_hier order by hier_order; HIER_ORDER gives tree ordering, use DEPTH and IS_LEAF to picture tree
  • 40. HIER_ORDER TREE MEMBER_UNIQUE_NAME ---------- -------------------- ------------------ 0 + ALL ITEMS [ALL].[ALL ITEMS] 1 + For the beach [CATEGORY].&[2] 2 - Bikini [ITEM].&[230] 3 - Sunglasses [ITEM].&[200] 4 - Surfboard [ITEM].&[220] 5 - Volleyball [ITEM].&[210] 6 + Winter sports [CATEGORY].&[1] 7 - Bob sled [ITEM].&[130] 8 - Ice skates [ITEM].&[110] 9 - Ski gloves [ITEM].&[120] 10 - Snowboard [ITEM].&[100] 11 rows selected. Hierarchy tree Analytic views in Oracle 12.221 12/8/2017 select hier_order , lpad(' ', depth * 2) || case is_leaf when 0 then '+ ' else '- ' end || member_name as tree , member_unique_name from item_category_hier order by hier_order; HIER_ORDER gives tree ordering, use DEPTH and IS_LEAF to picture tree
  • 41. create or replace attribute dimension customer_attr_dim using customer_dim_view attributes ( customer_id, customer_name, custgroup_id, custgroup_name , state_id , state_name , country_id , country_name ) level customer key customer_id member name customer_name determines (custgroup_id, state_id) level custgroup key custgroup_id member name custgroup_name level state key state_id member name state_name determines (country_id) level country key country_id member name country_name all member name 'ALL CUSTOMERS'; HIERARCHY - Multiple Analytic views in Oracle 12.222 12/8/2017 Attribute dimension
  • 42. create or replace attribute dimension customer_attr_dim using customer_dim_view attributes ( customer_id, customer_name, custgroup_id, custgroup_name , state_id , state_name , country_id , country_name ) level customer key customer_id member name customer_name determines (custgroup_id, state_id) level custgroup key custgroup_id member name custgroup_name level state key state_id member name state_name determines (country_id) level country key country_id member name country_name all member name 'ALL CUSTOMERS'; HIERARCHY - Multiple Analytic views in Oracle 12.222 12/8/2017 Attribute dimension create or replace hierarchy customer_group_hier using customer_attr_dim ( customer child of custgroup ); Hierarchy
  • 43. create or replace attribute dimension customer_attr_dim using customer_dim_view attributes ( customer_id, customer_name, custgroup_id, custgroup_name , state_id , state_name , country_id , country_name ) level customer key customer_id member name customer_name determines (custgroup_id, state_id) level custgroup key custgroup_id member name custgroup_name level state key state_id member name state_name determines (country_id) level country key country_id member name country_name all member name 'ALL CUSTOMERS'; HIERARCHY - Multiple Analytic views in Oracle 12.222 12/8/2017 Attribute dimension create or replace hierarchy customer_group_hier using customer_attr_dim ( customer child of custgroup ); Hierarchy create or replace hierarchy customer_state_country_hier using customer_attr_dim ( customer child of state child of country ); Hierarchy
  • 44. create or replace attribute dimension date_attr_dim dimension type time using date_dim attributes ( date_id , date_name , month_id , month_name , qtr_id , qtr_name , year_id , year_name , mthofyr_id , mthofyr_name , season_id , season_name ) level day level type days key date_id member name date_name order by date_id determines (month_id, mthofyr_id) level month level type months key month_id member name month_name order by month_id determines (qtr_id, mthofyr_id) level quarter level type quarters key qtr_id member name qtr_name order by qtr_id determines (year_id) level year level type years key year_id member name year_name order by year_id level mthofyr level type months key mthofyr_id member name mthofyr_name order by mthofyr_id determines (season_id) level season level type quarters key season_id member name season_name order by season_id all member name 'ALL DATES'; HIERARCHY – Dimension type TIME Analytic views in Oracle 12.223 12/8/2017 Attribute dimension
  • 45. create or replace attribute dimension date_attr_dim dimension type time using date_dim attributes ( date_id , date_name , month_id , month_name , qtr_id , qtr_name , year_id , year_name , mthofyr_id , mthofyr_name , season_id , season_name ) level day level type days key date_id member name date_name order by date_id determines (month_id, mthofyr_id) level month level type months key month_id member name month_name order by month_id determines (qtr_id, mthofyr_id) level quarter level type quarters key qtr_id member name qtr_name order by qtr_id determines (year_id) level year level type years key year_id member name year_name order by year_id level mthofyr level type months key mthofyr_id member name mthofyr_name order by mthofyr_id determines (season_id) level season level type quarters key season_id member name season_name order by season_id all member name 'ALL DATES'; HIERARCHY – Dimension type TIME Analytic views in Oracle 12.223 12/8/2017 Attribute dimension create or replace hierarchy date_mth_qtr_yr_hier using date_attr_dim ( day child of month child of quarter child of year ); Hierarchy
  • 46. create or replace attribute dimension date_attr_dim dimension type time using date_dim attributes ( date_id , date_name , month_id , month_name , qtr_id , qtr_name , year_id , year_name , mthofyr_id , mthofyr_name , season_id , season_name ) level day level type days key date_id member name date_name order by date_id determines (month_id, mthofyr_id) level month level type months key month_id member name month_name order by month_id determines (qtr_id, mthofyr_id) level quarter level type quarters key qtr_id member name qtr_name order by qtr_id determines (year_id) level year level type years key year_id member name year_name order by year_id level mthofyr level type months key mthofyr_id member name mthofyr_name order by mthofyr_id determines (season_id) level season level type quarters key season_id member name season_name order by season_id all member name 'ALL DATES'; HIERARCHY – Dimension type TIME Analytic views in Oracle 12.223 12/8/2017 Attribute dimension create or replace hierarchy date_mth_qtr_yr_hier using date_attr_dim ( day child of month child of quarter child of year ); Hierarchy create or replace hierarchy date_mth_season_hier using date_attr_dim ( day child of mthofyr child of season ); Hierarchy
  • 47. Analytic views in Oracle 12.224 12/8/2017 ANALYTIC VIEW
  • 48. ANALYTIC VIEW Analytic views in Oracle 12.225 12/8/2017 Metadata – not storing values. Values stay in base table Based on fact table, attribute dimensions and hierarchies Defining relations between fact and one or more dimensions Defining which hierarchies of the dimension can be used in the view Defining measures: – Based on fact columns or calculations – Expanded analytic syntax supports hierarchies – Defines which aggregations to be used on measures
  • 49. ANALYTIC VIEW Analytic views in Oracle 12.226 12/8/2017 create table sales_fact ( sales_date date not null references date_dim , item_id integer not null references item_dim , customer_id integer not null references customer_dim , qty number not null , amount number not null , cost number not null ); Fact table
  • 50. ANALYTIC VIEW Analytic views in Oracle 12.226 12/8/2017 create table sales_fact ( sales_date date not null references date_dim , item_id integer not null references item_dim , customer_id integer not null references customer_dim , qty number not null , amount number not null , cost number not null ); Fact table create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Analytic view
  • 51. Dimension clauses Analytic views in Oracle 12.227 12/8/2017 create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Analytic view
  • 52. Dimension clauses Analytic views in Oracle 12.227 12/8/2017 create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Analytic view date_attr_dim key sales_date references date_id hierarchies ( date_mth_qtr_yr_hier default , date_wk_yr_hier , date_mth_season_hier ) , item_attr_dim key item_id references item_id hierarchies ( item_category_hier default ) , customer_attr_dim key customer_id references customer_id hierarchies ( customer_group_hier default , customer_state_country_hier ) Dimension clauses
  • 53. create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Measure clauses Analytic views in Oracle 12.228 12/8/2017 Analytic view
  • 54. create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Measure clauses Analytic views in Oracle 12.228 12/8/2017 Analytic view qty fact qty , amount fact amount , cost fact cost , max_qty fact qty aggregate by max , avg_amount fact amount aggregate by avg , profit as (amount - cost) , piece_profit as (profit / nullif(qty,0)) , margin as (100 * profit / nullif(amount,0)) Simple
  • 55. create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Measure clauses Analytic views in Oracle 12.228 12/8/2017 Analytic view qty fact qty , amount fact amount , cost fact cost , max_qty fact qty aggregate by max , avg_amount fact amount aggregate by avg , profit as (amount - cost) , piece_profit as (profit / nullif(qty,0)) , margin as (100 * profit / nullif(amount,0)) Simple , amount_prior_period as ( lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_next_period as ( lead(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_prior_qtr as ( lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1 across ancestor at level quarter) ) , amount_diff_prior_period as ( lag_diff(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_diff_pct_prior_period as ( lag_diff_percent(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) Lead / Lag
  • 56. create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Measure clauses Analytic views in Oracle 12.228 12/8/2017 Analytic view qty fact qty , amount fact amount , cost fact cost , max_qty fact qty aggregate by max , avg_amount fact amount aggregate by avg , profit as (amount - cost) , piece_profit as (profit / nullif(qty,0)) , margin as (100 * profit / nullif(amount,0)) Simple , amount_prior_period as ( lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_next_period as ( lead(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_prior_qtr as ( lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1 across ancestor at level quarter) ) , amount_diff_prior_period as ( lag_diff(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_diff_pct_prior_period as ( lag_diff_percent(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) Lead / Lag , cost_ytd as ( sum(cost) over ( hierarchy date_mth_qtr_yr_hier between unbounded preceding and current member within ancestor at level year ) ) , cost_qtd as ( sum(cost) over ( hierarchy date_mth_qtr_yr_hier between unbounded preceding and current member within ancestor at level quarter ) ) Window
  • 57. create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Measure clauses Analytic views in Oracle 12.228 12/8/2017 Analytic view qty fact qty , amount fact amount , cost fact cost , max_qty fact qty aggregate by max , avg_amount fact amount aggregate by avg , profit as (amount - cost) , piece_profit as (profit / nullif(qty,0)) , margin as (100 * profit / nullif(amount,0)) Simple , amount_prior_period as ( lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_next_period as ( lead(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_prior_qtr as ( lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1 across ancestor at level quarter) ) , amount_diff_prior_period as ( lag_diff(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_diff_pct_prior_period as ( lag_diff_percent(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) Lead / Lag , cost_ytd as ( sum(cost) over ( hierarchy date_mth_qtr_yr_hier between unbounded preceding and current member within ancestor at level year ) ) , cost_qtd as ( sum(cost) over ( hierarchy date_mth_qtr_yr_hier between unbounded preceding and current member within ancestor at level quarter ) ) Window , margin_2014 as ( qualify( margin, date_mth_qtr_yr_hier = year[2014] ) ) , margin_2015_point_diff_2014 as ( qualify( margin, date_mth_qtr_yr_hier = year[2015] ) - qualify( margin, date_mth_qtr_yr_hier = year[2014] ) ) , cost_ytd_prior_year as ( qualify( cost_ytd , date_mth_qtr_yr_hier = hier_lag( current member offset 1 across ancestor at level year ) ) ) Qualify (QDR)
  • 58. create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum; Measure clauses Analytic views in Oracle 12.228 12/8/2017 Analytic view qty fact qty , amount fact amount , cost fact cost , max_qty fact qty aggregate by max , avg_amount fact amount aggregate by avg , profit as (amount - cost) , piece_profit as (profit / nullif(qty,0)) , margin as (100 * profit / nullif(amount,0)) Simple , amount_prior_period as ( lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_next_period as ( lead(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_prior_qtr as ( lag(amount) over (hierarchy date_mth_qtr_yr_hier offset 1 across ancestor at level quarter) ) , amount_diff_prior_period as ( lag_diff(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) , amount_diff_pct_prior_period as ( lag_diff_percent(amount) over (hierarchy date_mth_qtr_yr_hier offset 1) ) Lead / Lag , cost_ytd as ( sum(cost) over ( hierarchy date_mth_qtr_yr_hier between unbounded preceding and current member within ancestor at level year ) ) , cost_qtd as ( sum(cost) over ( hierarchy date_mth_qtr_yr_hier between unbounded preceding and current member within ancestor at level quarter ) ) Window , margin_2014 as ( qualify( margin, date_mth_qtr_yr_hier = year[2014] ) ) , margin_2015_point_diff_2014 as ( qualify( margin, date_mth_qtr_yr_hier = year[2015] ) - qualify( margin, date_mth_qtr_yr_hier = year[2014] ) ) , cost_ytd_prior_year as ( qualify( cost_ytd , date_mth_qtr_yr_hier = hier_lag( current member offset 1 across ancestor at level year ) ) ) Qualify (QDR) , profit_share_geo_parent as ( share_of( profit hierarchy customer_state_country_hier parent ) ) , profit_share_category as ( share_of( profit hierarchy item_category_hier level category ) ) Share of
  • 59. Analytic views in Oracle 12.229 12/8/2017 Querying with SQL
  • 60. Expanded SQL Analytic views in Oracle 12.230 12/8/2017 Much added analytic syntax within analytic view definitions Hierarchies member names allow MDX-like member filter SELECT can query from analytic view, specifying desired hierarchies Analytic view measures and hierarchy columns can be used as normal column expressions in select list, where clause, etc. As it is all metadata, selecting from analytic view and hierarchies is actually rewritten to SQL with joins, aggregations and calculations on the base tables
  • 61. Query example Analytic views in Oracle 12.231 12/8/2017 select date_mth_qtr_yr_hier.member_name as month , amount, amount_prior_period, amount_diff_prior_period , round(amount_diff_pct_prior_period * 100, 1) as pct from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.level_name = 'MONTH' order by date_mth_qtr_yr_hier.hier_order; Query
  • 62. Query example Analytic views in Oracle 12.231 12/8/2017 select date_mth_qtr_yr_hier.member_name as month , amount, amount_prior_period, amount_diff_prior_period , round(amount_diff_pct_prior_period * 100, 1) as pct from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.level_name = 'MONTH' order by date_mth_qtr_yr_hier.hier_order; Query MONTH AMOUNT AMOUNT_PRIOR_PERIOD AMOUNT_DIFF_PRIOR_PERIOD PCT ---------- ---------- ------------------- ------------------------ ---------- 2014-01 179918.38 2014-02 162298.66 179918.38 -17619.72 -9.8 2014-03 83065.78 162298.66 -79232.88 -48.8 2014-04 79792.79 83065.78 -3272.99 -3.9 2014-05 82464.93 79792.79 2672.14 3.3 2014-06 121360.52 82464.93 38895.59 47.2 2014-07 125733.23 121360.52 4372.71 3.6 2014-08 126837.02 125733.23 1103.79 .9 ... 2017-09 71217.78 125615.93 -54398.15 -43.3 2017-10 73094.69 71217.78 1876.91 2.6 2017-11 70147.02 73094.69 -2947.67 -4 2017-12 179949.06 70147.02 109802.04 156.5 48 rows selected. Output
  • 63. Query example Analytic views in Oracle 12.232 12/8/2017 select date_mth_qtr_yr_hier.member_name as quarter , amount, amount_prior_period , cost_ytd, cost_ytd_prior_year from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.parent_unique_name = '[YEAR].&[2015]' order by date_mth_qtr_yr_hier.hier_order; Query
  • 64. Query example Analytic views in Oracle 12.232 12/8/2017 select date_mth_qtr_yr_hier.member_name as quarter , amount, amount_prior_period , cost_ytd, cost_ytd_prior_year from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.parent_unique_name = '[YEAR].&[2015]' order by date_mth_qtr_yr_hier.hier_order; Query QUARTER AMOUNT AMOUNT_PRIOR_PERIOD COST_YTD COST_YTD_PRIOR_YEAR ---------- ---------- ------------------- ---------- ------------------- 2015-Q1 423988.68 324418.81 148103.48 148394.1 2015-Q2 284102.26 423988.68 244424.98 244437.42 2015-Q3 321613.01 284102.26 352579.29 352676.94 2015-Q4 323018.87 321613.01 466129.48 466399.24 Output
  • 65. Query example Analytic views in Oracle 12.233 12/8/2017 select lpad(' ', date_mth_qtr_yr_hier.depth * 2) || date_mth_qtr_yr_hier.member_name as period , qty, max_qty, cost, cost_qtd from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.year_id = 2015 and date_mth_qtr_yr_hier.is_leaf = 0 order by date_mth_qtr_yr_hier.hier_order; Query
  • 66. Query example Analytic views in Oracle 12.233 12/8/2017 select lpad(' ', date_mth_qtr_yr_hier.depth * 2) || date_mth_qtr_yr_hier.member_name as period , qty, max_qty, cost, cost_qtd from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.year_id = 2015 and date_mth_qtr_yr_hier.is_leaf = 0 order by date_mth_qtr_yr_hier.hier_order; Query PERIOD QTY MAX_QTY COST COST_QTD --------------- ---------- ---------- ---------- ---------- 2015 25844 14 466129.48 2015-Q1 7792 14 148103.48 148103.48 2015-01 3469 14 63084.74 63084.74 2015-02 3117 14 56645.04 119729.78 2015-03 1206 7 28373.7 148103.48 2015-Q2 5466 14 96321.5 96321.5 2015-04 1164 7 27785.33 27785.33 2015-05 1206 7 28432.84 56218.17 2015-06 3096 14 40103.33 96321.5 2015-Q3 7291 14 108154.31 108154.31 2015-07 3190 14 41473.46 41473.46 2015-08 3189 14 41514.96 82988.42 2015-09 912 7 25165.89 108154.31 2015-Q4 5295 14 113550.19 113550.19 2015-10 936 7 25682.68 25682.68 2015-11 899 7 24789.31 50471.99 2015-12 3460 14 63078.2 113550.19 Output
  • 67. Query example Analytic views in Oracle 12.234 12/8/2017 select date_mth_qtr_yr_hier.member_name as year , qty, amount, amount_next_period, cost, profit from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.level_name = 'YEAR' order by date_mth_qtr_yr_hier.hier_order; Query
  • 68. Query example Analytic views in Oracle 12.234 12/8/2017 select date_mth_qtr_yr_hier.member_name as year , qty, amount, amount_next_period, cost, profit from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.level_name = 'YEAR' order by date_mth_qtr_yr_hier.hier_order; Query YEAR QTY AMOUNT AMOUNT_NEXT_PERIOD COST PROFIT ---------- ---------- ---------- ------------------ ---------- ---------- 2014 25823 1356119.17 1352722.82 466399.24 889719.93 2015 25844 1352722.82 1360671.25 466129.48 886593.34 2016 25968 1360671.25 1357019.68 468413.17 892258.08 2017 25845 1357019.68 467039.17 889980.51 Output
  • 69. Query example Analytic views in Oracle 12.235 12/8/2017 select lpad(' ', item_category_hier.depth * 2) || item_category_hier.member_name as item_category , qty, amount, profit, margin from sales_av hierarchies ( item_category_hier, date_mth_season_hier ) where date_mth_season_hier.member_unique_name = '[SEASON].&[3]' --Summer order by item_category_hier.hier_order; Query
  • 70. Query example Analytic views in Oracle 12.235 12/8/2017 select lpad(' ', item_category_hier.depth * 2) || item_category_hier.member_name as item_category , qty, amount, profit, margin from sales_av hierarchies ( item_category_hier, date_mth_season_hier ) where date_mth_season_hier.member_unique_name = '[SEASON].&[3]' --Summer order by item_category_hier.hier_order; Query ITEM_CATEGORY QTY AMOUNT PROFIT MARGIN --------------- ---------- ---------- ---------- ---------- ALL ITEMS 37876 1494665.2 1001155.45 66.9819201 For the beach 36402 1457944.92 977999.28 67.0806741 Bikini 9105 354302.87 264750.11 74.7242352 Sunglasses 9107 185334.38 120266.14 64.8914357 Surfboard 9090 774906.81 482142.21 62.2193796 Volleyball 9100 143400.86 110840.82 77.29439 Winter sports 1474 36720.28 23156.17 63.0609843 Bob sled 368 4631.11 3623.35 78.2393422 Ice skates 367 13153.87 7476.55 56.839166 Ski gloves 369 2457.34 1121.98 45.6583135 Snowboard 370 16477.96 10934.29 66.3570612 Output
  • 71. Query example Analytic views in Oracle 12.236 12/8/2017 select lpad(' ', customer_state_country_hier.depth * 2) || customer_state_country_hier.member_name as cust_state_ctry , qty, amount, avg_amount, profit from sales_av hierarchies ( customer_state_country_hier, item_category_hier ) where item_category_hier.member_unique_name = '[CATEGORY].&[2]' --Beach order by customer_state_country_hier.hier_order; Query
  • 72. Query example Analytic views in Oracle 12.236 12/8/2017 select lpad(' ', customer_state_country_hier.depth * 2) || customer_state_country_hier.member_name as cust_state_ctry , qty, amount, avg_amount, profit from sales_av hierarchies ( customer_state_country_hier, item_category_hier ) where item_category_hier.member_unique_name = '[CATEGORY].&[2]' --Beach order by customer_state_country_hier.hier_order; Query CUST_STATE_CTRY QTY AMOUNT AVG_AMOUNT PROFIT ---------------------- ---------- ---------- ---------- ---------- ALL CUSTOMERS 52082 2387671.07 179.026098 1594808.4 Germany 29797 1163811.78 167.768744 750617.64 Bayern 12555 460764.43 172.765066 302102.11 ABCD GmbH 10013 254860.06 159.387154 158966.79 Heinz Schubert 2542 205904.37 192.794354 143135.32 Niedersachsen 17242 703047.35 164.648091 448515.53 Backhaus Buhl 10021 218548.99 136.507801 122567.05 Gemeinde Stade 4678 307779.42 192.362138 212103.28 Heidi Schmidt 2543 176718.94 165.312385 113845.2 USA 22285 1223859.29 191.228014 844190.76 California 9746 807579.34 216.10365 586449.67 Jack Howell 2538 215165.23 201.465571 152604.75 Jill Hamilton 2540 215224.69 201.332732 152618.92 LAPD 4668 377189.42 235.743388 281226 New Hampshire 12539 416279.95 156.319921 257741.09 Sam Flyingbear 2536 186109.84 174.587092 123362.15 Woods Burgers 10003 230170.11 144.126556 134378.94 Output
  • 73. Query example Analytic views in Oracle 12.237 12/8/2017 select lpad(' ', customer_state_country_hier.depth * 2) || customer_state_country_hier.member_name as country , lpad(' ', item_category_hier.depth * 2) || item_category_hier.member_name as category , qty, amount from sales_av hierarchies ( customer_state_country_hier , item_category_hier , date_mth_season_hier ) where customer_state_country_hier.depth <= 1 and item_category_hier.depth <= 1 and date_mth_season_hier.member_unique_name = '[MTHOFYR].&[4]' --April order by customer_state_country_hier.hier_order , item_category_hier.hier_order; Query
  • 74. Query example Analytic views in Oracle 12.237 12/8/2017 select lpad(' ', customer_state_country_hier.depth * 2) || customer_state_country_hier.member_name as country , lpad(' ', item_category_hier.depth * 2) || item_category_hier.member_name as category , qty, amount from sales_av hierarchies ( customer_state_country_hier , item_category_hier , date_mth_season_hier ) where customer_state_country_hier.depth <= 1 and item_category_hier.depth <= 1 and date_mth_season_hier.member_unique_name = '[MTHOFYR].&[4]' --April order by customer_state_country_hier.hier_order , item_category_hier.hier_order; Query COUNTRY CATEGORY QTY AMOUNT --------------- --------------- ---------- ---------- ALL CUSTOMERS ALL ITEMS 4668 319763.47 ALL CUSTOMERS For the beach 3140 210251.43 ALL CUSTOMERS Winter sports 1528 109512.04 Germany ALL ITEMS 2744 162297.46 Germany For the beach 1824 103317.01 Germany Winter sports 920 58980.45 USA ALL ITEMS 1924 157466.01 USA For the beach 1316 106934.42 USA Winter sports 608 50531.59 Output
  • 75. Analytic views in Oracle 12.238 12/8/2017 Performance
  • 76. It’s just SQL Analytic views in Oracle 12.239 12/8/2017 Rewritten to regular SQL means tuning can use anything that can tune SQL Indexes Index Organized Tables In Memory option Query Rewrite – Pre-aggregation with materialized views
  • 77. SELECT rewrite Analytic views in Oracle 12.240 12/8/2017 select date_mth_qtr_yr_hier.member_name as month , amount, amount_prior_period, amount_diff_prior_period , round(amount_diff_pct_prior_period * 100, 1) as pct from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.level_name = 'MONTH' order by date_mth_qtr_yr_hier.hier_order; Query
  • 78. SELECT rewrite Analytic views in Oracle 12.240 12/8/2017 select date_mth_qtr_yr_hier.member_name as month , amount, amount_prior_period, amount_diff_prior_period , round(amount_diff_pct_prior_period * 100, 1) as pct from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.level_name = 'MONTH' order by date_mth_qtr_yr_hier.hier_order; Query SELECT "A1"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MEMBER_NAME" "MONTH","A1"."MEASURES#AMOUNT" "AMOUNT","A1"."MEASURES#AMOUNT_PR IOR_PER IOD" "AMOUNT_PRIOR_PERIOD","A1"."MEASURES#AMOUNT_DIFF_PRIOR_PERIOD" "AMOUNT_DIFF_PRIOR_PERIOD",ROUND("A1"."MEASURES#AMOUNT_DI FF_PCT_ PRIOR_PERIOD"*100,1) "PCT" FROM (SELECT "A33"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MEMBER_NAME" "DATE_ATTR_DIM#DATE_MTH_QTR_Y R_HIER# MEMBER_NAME","A33"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#LEVEL_NAME" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#LEVEL_NAME","A33"."DAT E_ATTR_ DIM#DATE_MTH_QTR_YR_HIER#HIER_ORDER" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#HIER_ORDER","A34"."MEASURES#AMOUNT" "MEASURES#AMOUNT ","A34" ."MEASURES#AMOUNT_PRIOR_PERIOD" "MEASURES#AMOUNT_PRIOR_PERIOD","A34"."MEASURES#AMOUNT_DIFF_PRIOR_PERIOD" "MEASURES#AMOUNT_DIF F_PRIOR _PERIOD","A34"."MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" "MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" FROM (SELECT "A5"."DATE_ATTR_ DIM#DAT E_MTH_QTR_YR_HIER#DEPTH$" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DEPTH$","A5"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" "DAT E_ATTR_ DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A5"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_I D","A5" ."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID","A5"."DATE_ATTR_DIM#DATE_MTH_QTR _YR_HIE R#DATE_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID","A5"."MEASURES#AMOUNT" "MEASURES#AMOUNT","A4"."MEAS$" "MEASURES#AMOUN T_PRIOR _PERIOD","A3"."MEAS$" "MEASURES#AMOUNT_DIFF_PRIOR_PERIOD","A2"."MEAS$" "MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" FROM (SELECT /*+ NO_ EXPAND */ SUM("SP"."MEASURES#AMOUNT") "MEASURES#AMOUNT","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$"."DATE_ATTR_DIM#DAT E_MTH_Q TR_YR_HIER#DEPTH$" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DEPTH$","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$"."DATE_ATTR_ DIM#DAT E_MTH_QTR_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$". "DATE_A TTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TAR GETS$". "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID",CAST(NULL AS date) "DATE_ATTR_DIM #DATE_M TH_QTR_YR_HIER#DATE_ID" FROM (SELECT /*+ VECTOR_TRANSFORM */ SUM("A14"."AMOUNT") "MEASURES#AMOUNT","A13"."DATE_ATTR_DIM#DATE _MTH_QT R_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A13"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATT R_DIM#D ATE_MTH_QTR_YR_HIER#QTR_ID","A13"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" ,CAST(N ULL AS date) "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID" FROM "AV_USER"."SALES_FACT" "A14", (SELECT "A15"."DATE_ATTR_DIM#DAT E_ID" " DATE_ATTR_DIM#DATE_ID","A15"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A15 "."DATE _ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","A15"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER# MONTH_I D" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID",CAST(NULL AS date) "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID" FROM (SELEC T "A16" ."DATE_ATTR_DIM#DATE_ID" "DATE_ATTR_DIM#DATE_ID","A16"."DATE_ATTR_DIM#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" ,"A16". "DATE_ATTR_DIM#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","A16"."DATE_ATTR_DIM#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR _YR_HIE R#MONTH_ID" FROM (SELECT "A32"."DATE_ID" "DATE_ATTR_DIM#DATE_ID","A32"."DATE_NAME" "DATE_ATTR_DIM#DATE_NAME","A32"."MONTH_ID " "DATE _ATTR_DIM#MONTH_ID","A32"."MONTH_NAME" "DATE_ATTR_DIM#MONTH_NAME","A32"."QTR_ID" "DATE_ATTR_DIM#QTR_ID","A32"."QTR_NAME" "DAT E_ATTR_ DIM#QTR_NAME","A32"."CYEAR_ID" "DATE_ATTR_DIM#CYEAR_ID","A32"."CYEAR_NAME" "DATE_ATTR_DIM#CYEAR_NAME","A32"."WEEK_ID" "DATE_A TTR_DIM #WEEK_ID","A32"."WEEK_NAME" "DATE_ATTR_DIM#WEEK_NAME","A32"."WYEAR_ID" "DATE_ATTR_DIM#WYEAR_ID","A32"."WYEAR_NAME" "DATE_ATTR _DIM#WY ... ... ... ... ... ... ... ... ... ... DBMS_UTILITY.EXPAND_SQL_TEXT output
  • 79. SELECT rewrite Analytic views in Oracle 12.240 12/8/2017 select date_mth_qtr_yr_hier.member_name as month , amount, amount_prior_period, amount_diff_prior_period , round(amount_diff_pct_prior_period * 100, 1) as pct from sales_av hierarchies ( date_mth_qtr_yr_hier ) where date_mth_qtr_yr_hier.level_name = 'MONTH' order by date_mth_qtr_yr_hier.hier_order; Query SELECT "A1"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MEMBER_NAME" "MONTH","A1"."MEASURES#AMOUNT" "AMOUNT","A1"."MEASURES#AMOUNT_PR IOR_PER IOD" "AMOUNT_PRIOR_PERIOD","A1"."MEASURES#AMOUNT_DIFF_PRIOR_PERIOD" "AMOUNT_DIFF_PRIOR_PERIOD",ROUND("A1"."MEASURES#AMOUNT_DI FF_PCT_ PRIOR_PERIOD"*100,1) "PCT" FROM (SELECT "A33"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MEMBER_NAME" "DATE_ATTR_DIM#DATE_MTH_QTR_Y R_HIER# MEMBER_NAME","A33"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#LEVEL_NAME" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#LEVEL_NAME","A33"."DAT E_ATTR_ DIM#DATE_MTH_QTR_YR_HIER#HIER_ORDER" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#HIER_ORDER","A34"."MEASURES#AMOUNT" "MEASURES#AMOUNT ","A34" ."MEASURES#AMOUNT_PRIOR_PERIOD" "MEASURES#AMOUNT_PRIOR_PERIOD","A34"."MEASURES#AMOUNT_DIFF_PRIOR_PERIOD" "MEASURES#AMOUNT_DIF F_PRIOR _PERIOD","A34"."MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" "MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" FROM (SELECT "A5"."DATE_ATTR_ DIM#DAT E_MTH_QTR_YR_HIER#DEPTH$" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DEPTH$","A5"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" "DAT E_ATTR_ DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A5"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_I D","A5" ."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID","A5"."DATE_ATTR_DIM#DATE_MTH_QTR _YR_HIE R#DATE_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID","A5"."MEASURES#AMOUNT" "MEASURES#AMOUNT","A4"."MEAS$" "MEASURES#AMOUN T_PRIOR _PERIOD","A3"."MEAS$" "MEASURES#AMOUNT_DIFF_PRIOR_PERIOD","A2"."MEAS$" "MEASURES#AMOUNT_DIFF_PCT_PRIOR_PERIOD" FROM (SELECT /*+ NO_ EXPAND */ SUM("SP"."MEASURES#AMOUNT") "MEASURES#AMOUNT","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$"."DATE_ATTR_DIM#DAT E_MTH_Q TR_YR_HIER#DEPTH$" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DEPTH$","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$"."DATE_ATTR_ DIM#DAT E_MTH_QTR_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TARGETS$". "DATE_A TTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#AGGR_TAR GETS$". "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID",CAST(NULL AS date) "DATE_ATTR_DIM #DATE_M TH_QTR_YR_HIER#DATE_ID" FROM (SELECT /*+ VECTOR_TRANSFORM */ SUM("A14"."AMOUNT") "MEASURES#AMOUNT","A13"."DATE_ATTR_DIM#DATE _MTH_QT R_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A13"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATT R_DIM#D ATE_MTH_QTR_YR_HIER#QTR_ID","A13"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID" ,CAST(N ULL AS date) "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID" FROM "AV_USER"."SALES_FACT" "A14", (SELECT "A15"."DATE_ATTR_DIM#DAT E_ID" " DATE_ATTR_DIM#DATE_ID","A15"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID","A15 "."DATE _ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","A15"."DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER# MONTH_I D" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#MONTH_ID",CAST(NULL AS date) "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#DATE_ID" FROM (SELEC T "A16" ."DATE_ATTR_DIM#DATE_ID" "DATE_ATTR_DIM#DATE_ID","A16"."DATE_ATTR_DIM#CYEAR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#CYEAR_ID" ,"A16". "DATE_ATTR_DIM#QTR_ID" "DATE_ATTR_DIM#DATE_MTH_QTR_YR_HIER#QTR_ID","A16"."DATE_ATTR_DIM#MONTH_ID" "DATE_ATTR_DIM#DATE_MTH_QTR _YR_HIE R#MONTH_ID" FROM (SELECT "A32"."DATE_ID" "DATE_ATTR_DIM#DATE_ID","A32"."DATE_NAME" "DATE_ATTR_DIM#DATE_NAME","A32"."MONTH_ID " "DATE _ATTR_DIM#MONTH_ID","A32"."MONTH_NAME" "DATE_ATTR_DIM#MONTH_NAME","A32"."QTR_ID" "DATE_ATTR_DIM#QTR_ID","A32"."QTR_NAME" "DAT E_ATTR_ DIM#QTR_NAME","A32"."CYEAR_ID" "DATE_ATTR_DIM#CYEAR_ID","A32"."CYEAR_NAME" "DATE_ATTR_DIM#CYEAR_NAME","A32"."WEEK_ID" "DATE_A TTR_DIM #WEEK_ID","A32"."WEEK_NAME" "DATE_ATTR_DIM#WEEK_NAME","A32"."WYEAR_ID" "DATE_ATTR_DIM#WYEAR_ID","A32"."WYEAR_NAME" "DATE_ATTR _DIM#WY ... ... ... ... ... ... ... ... ... ... DBMS_UTILITY.EXPAND_SQL_TEXT output 8289108 BYTES of SQL ABOUT 8 MB
  • 80. Materialized views Analytic views in Oracle 12.241 12/8/2017 create or replace analytic view sales_av using sales_fact dimension by ( ((dimension clauses)) ) measures ( ((measure clauses)) ) default measure amount default aggregate by sum cache measure group all levels (date_mth_qtr_yr_hier.month ) materialized levels (date_wk_yr_hier.week ) materialized levels (date_mth_season_hier.mthofyr ) materialized levels (item_category_hier.category ) materialized levels (customer_group_hier.custgroup ) materialized levels (customer_state_country_hier.state) materialized ; Query rewrite on materialized views very useful method to gain performance Syntax supports making analytic view aware of such materialized views CACHE syntax makes SQL generator of AV select aware of mat.views, so it generates SQL using the MV's (Rather than relying on magic of normal query rewrite)
  • 81. Analytic views in Oracle 12.242 12/8/2017 Classifications
  • 82. Classifications Analytic views in Oracle 12.243 12/8/2017 Metadata of dimensions, hierarchies, analytic views, members, attributes, measures – Caption - either in full classification syntax or shortcut – Description - either in full classification syntax or shortcut – Formatting - only in full classification syntax Can be in multiple languages - only in full classification syntax Not used in querying with SQL – But can be queried from dictionary views Meant for visualization tools – Classifications available via drivers, for example OLE DB for OLAP Provider
  • 83. create or replace attribute dimension item_attr_dim caption 'Items' description 'Item attribute dimension' using item_dim attributes ( item_id caption 'Item id' , item_name caption 'Item name' , category_id caption 'Category id' , category_name caption 'Category name' ) level item caption 'Item' description 'Items in product catalogue' key item_id alternate key item_name member name item_name member caption item_name order by item_name determines (category_id) level category caption 'Item category' description 'Categorization of items' key category_id alternate key category_name member name category_name member caption category_name order by category_name all member name 'ALL ITEMS' member caption 'All items' member description ‘All items in catalogue' Caption and Description shortcuts Analytic views in Oracle 12.244 12/8/2017 Attribute dimension
  • 84. create or replace attribute dimension item_attr_dim caption 'Items' description 'Item attribute dimension' using item_dim attributes ( item_id caption 'Item id' , item_name caption 'Item name' , category_id caption 'Category id' , category_name caption 'Category name' ) level item caption 'Item' description 'Items in product catalogue' key item_id alternate key item_name member name item_name member caption item_name order by item_name determines (category_id) level category caption 'Item category' description 'Categorization of items' key category_id alternate key category_name member name category_name member caption category_name order by category_name all member name 'ALL ITEMS' member caption 'All items' member description ‘All items in catalogue' Caption and Description shortcuts Analytic views in Oracle 12.244 12/8/2017 Attribute dimension create or replace hierarchy date_mth_qtr_yr_hier caption 'D/M/Q/Y Hierarchy' description 'Hierarchy day-month-quarter-year' using date_attr_dim ( day child of month child of quarter child of cyear ); Hierarchy
  • 85. create or replace attribute dimension item_attr_dim caption 'Items' description 'Item attribute dimension' using item_dim attributes ( item_id caption 'Item id' , item_name caption 'Item name' , category_id caption 'Category id' , category_name caption 'Category name' ) level item caption 'Item' description 'Items in product catalogue' key item_id alternate key item_name member name item_name member caption item_name order by item_name determines (category_id) level category caption 'Item category' description 'Categorization of items' key category_id alternate key category_name member name category_name member caption category_name order by category_name all member name 'ALL ITEMS' member caption 'All items' member description ‘All items in catalogue' Caption and Description shortcuts Analytic views in Oracle 12.244 12/8/2017 Attribute dimension create or replace hierarchy date_mth_qtr_yr_hier caption 'D/M/Q/Y Hierarchy' description 'Hierarchy day-month-quarter-year' using date_attr_dim ( day child of month child of quarter child of cyear ); Hierarchy create or replace analytic view sales_av caption 'Sales analysis' description 'Analysis of sales by date, item and customer hierarchies' using sales_fact dimension by ( date_attr_dim caption 'Sales date dimension' description 'Date hierarchies for date of sales' key sales_date ... measures ( qty fact qty caption 'Quantity' description 'Sold quantity of items' , amount fact amount caption 'Amount' description 'Total amount for the sold items' ... Analytic view
  • 86. create or replace analytic view sales_av classification caption value 'Sales analysis' classification description value 'Analysis of sales by date, item and customer hierarchies' using sales_fact dimension by ( date_attr_dim classification caption value 'Sales date dimension' classification description value 'Date hierarchies for date of sales' classification my_own_class value 'My own dimension classification' key sales_date references date_id hierarchies ( ... /* my_own_class is user-defined classification, may be used by own application */ Classification long syntax Analytic views in Oracle 12.245 12/8/2017 Basic classifications
  • 87. create or replace analytic view sales_av classification caption value 'Sales analysis' classification description value 'Analysis of sales by date, item and customer hierarchies' using sales_fact dimension by ( date_attr_dim classification caption value 'Sales date dimension' classification description value 'Date hierarchies for date of sales' classification my_own_class value 'My own dimension classification' key sales_date references date_id hierarchies ( ... /* my_own_class is user-defined classification, may be used by own application */ Classification long syntax Analytic views in Oracle 12.245 12/8/2017 Basic classifications ... measures ( qty fact qty classification caption value 'Quantity' classification description value 'Sold quantity of items' classification format_string value '9,999' classification fore_color value '#FF0000' , amount fact amount classification caption value 'Amount' classification description value 'Total amount for the sold items' classification format_string value '$99,999.99' classification back_color value '#00FF00' ... Formatting
  • 88. create or replace analytic view sales_av classification caption value 'Sales analysis' classification description value 'Analysis of sales by date, item and customer hierarchies' using sales_fact dimension by ( date_attr_dim classification caption value 'Sales date dimension' classification description value 'Date hierarchies for date of sales' classification my_own_class value 'My own dimension classification' key sales_date references date_id hierarchies ( ... /* my_own_class is user-defined classification, may be used by own application */ Classification long syntax Analytic views in Oracle 12.245 12/8/2017 Basic classifications ... measures ( qty fact qty classification caption value 'Quantity' classification description value 'Sold quantity of items' classification format_string value '9,999' classification fore_color value '#FF0000' , amount fact amount classification caption value 'Amount' classification description value 'Total amount for the sold items' classification format_string value '$99,999.99' classification back_color value '#00FF00' ... Formatting create or replace attribute dimension item_attr_dim dimension type standard classification caption value 'Items' classification caption value 'Produkte' language 'GERMAN' classification caption value 'Varer' language 'DANISH' classification description value 'Item attribute dimension' classification description value 'Produkt Attribut Dimension' language 'GERMAN' classification description value 'Vare attribut dimension' language 'DANISH' using item_dim attributes ( ... /* Not specifying language means "Default" language, which the application may choose to pick if a classification in the specific name is not available */ Languages
  • 89. Analytic views in Oracle 12.246 12/8/2017 Summary
  • 90. Summary Analytic views in Oracle 12.247 12/8/2017 Analytic views allow dimensional analysis of data – On real-time data – Without copying data to datawarehouse and cube – Without writing complex analytic SQL in individual queries (complexity hidden in metadata allowing analysis queries to be simpler) “Standard” SQL tuning methods apply Metadata can be enriched with classifications for tool use (OLAP drivers can view the analytic views similar to a cube)
  • 91. Analytic views in Oracle 12.248 12/8/2017 Links This presentation PowerPoint http://bit.ly/kibeha_av122_pptx Script with all examples from this presentation http://bit.ly/kibeha_av122_sql
  • 92. Questions & Answers Kim Berg Hansen Senior Consultant kim.berghansen@trivadis.com 12/8/2017 Analytic views in Oracle 12.249 http://bit.ly/kibeha_av122_pptx http://bit.ly/kibeha_av122_sql

Editor's Notes

  1. “Our focus as IT consultants and system integrator lies on the business fields of Business Intelligence, Application Development, Infrastructure Engineering and Training. We have a separate division – Trivadis Services – which takes over the operation, maintenance and ongoing development of individual systems such as databases and specific applications, or we can also outsource the responsibility for more complex environments. We provide our services throughout Switzerland, Germany, Austria and Danmark and concentrate on Oracle and Microsoft technologies.”
  2. “We are a non-affiliated and profitable company with over 600 employees. Regional proximity to our customers is one of our key considerations. We achieve this by operating 14 branch operations in Switzerland, Germany, Austria and Danmark. We successfully completed more than 1900 customer projects during the last business year. Additionally, we also support our customers with over 200 Service Level Agreements. The basis for this sustained technological excellence is reflected in our research and development budget. Every year we invest around 5 million Swiss franks in analyzing and evaluating new technologies and developing our methods and products.”