This is not your father's OLAP - Oracle 12.2 Analytic Views are not just for BI or DW experts. Analytic Views offer “a fast and efficient way to create analytic queries of data stored in existing database tables and views”. They enable simpler SQL statements and improved performance for aggregate and calculation queries – a big advantage for any developer building BI-like reports for data warehouse, business intelligence or other data analysis purpose. Even if you never used Oracle OLAP and/or do not have OBIEE, if you create BI-like queries, Analytic Views deserve a look.
7. TH TechnologyTH Technology
Agenda
• What Are Analytical Views
• How to Build
• How to Query
• Who ~ Why ~ When ~Where to Use
• Questions ~ Discussion
9. TH TechnologyTH Technology
Oracle Objects
• Table
• Data Storage in Rows/Columns
• View - Virtual Table,
• No Data Storage (Stored SQL Query)
• Materialized View
• Stored Query Results
10. TH TechnologyTH Technology
Analytic View
• No Data Storage
• Organize Data via Dimensional Model
• Navigation, Join, Aggregation,
Calculation Rules Built In
• Complex Object → Simpler Queries
11. TH TechnologyTH Technology
Analytic Views
• Layer on Top of Star Schema
• Fact Data Included in AV
• Dimensions, Hierarchies Defined in
the AV
• Calculations Defined in the AV
• Metadata Built Into the AV
19
14. TH TechnologyTH Technology
Analytic Views
• Oracle 12.2 +
• No Cost Feature
• Like a View
• Does Not Store Data
• Query via SQL
• Access Data from Other Objects
• Join Multiple Tables
15. TH TechnologyTH Technology
Analytic Views
• Simplify SQL for Analytic Queries
• No Joins, No GROUP BYs
• Calculations Defined in Analytic View
• Aggregates ~ Calculations ~ Ranks ~ Forecasts
• Query Calc’d Values from the Analytic View
Make Dimensional, Hierarchical Analyses More Accessible
➔➔➔ Simpler, Faster Development
22. TH TechnologyTH Technology
System Privileges
• CREATE ANALYTIC VIEW
• CREATE ANY ANALYTIC VIEW
• ALTER ANY ANALYTIC VIEW
• DROP ANY ANALYTIC VIEW
• CREATE ATTRIBUTE DIMENSION
• CREATE ANY ATTRIBUTE DIMENSION
• ALTER ANY ATTRIBUTE DIMENSION
• DROP ANY ATTRIBUTE DIMENSION
• CREATE HIERARCHY
• CREATE ANY HIERARCHY
• ALTER ANY HIERARCHY
• DROP ANY HIERARCHY
23. TH TechnologyTH Technology
Object Privileges
• SELECT - Query
• READ - Query
• ALTER - Rename
Example grants:
GRANT ALL ON AVDEMO.SALES_AV TO AV_USER2;
GRANT ALTER ON AVDEMO.SALES_AV TO AV_USER3;
24. TH TechnologyTH Technology
AV Objects
• ATTRIBUTE DIMENSION
• Specifies Data Source, Attributes, Levels
• HIERARCHY
• Organizes Dimensions Hierarchically Order
• ANALYTIC VIEW
• Aggregations, Calculations, Joins of Fact Data
Specified by Attr. Dims, Hierarchies and
Measures Facts and Calcs
27. TH TechnologyTH Technology
Attribute Dimensions
• SH Time
• Base Calendar Year query
• Base Fiscal Year query
• These will be combined into one
Attr Dimension
36. TH TechnologyTH Technology
Analytic View – Parts Recap
• USING – Fact Table – Where to start
• DIMENSION BY – What Dimensions Queries on
the AV Will Use
• HIERARCHY – Which Hierarchies Queries Will Use
• MEASURES – Calculations: Sum, LEAD, LAG,
Combinations – What Calculations Are Needed
• CLASSIFICATION – Metadata - the Documentation
• Usually On AV and Measures
37. TH TechnologyTH Technology
Measures – Time Series
LAG 1 … ACROSS ANCESTOR AT LEVEL YEAR
Previous Year
AVG(sales) … BETWEEN 11 PRECEDING AND CURRENT
MEMBER
12 Month Period
See LiveSQL
Creating Time Series Calculations in Analytic
Views
52. TH TechnologyTH Technology
Use Analytic Views For …
• Data Warehousing
• Extend Star Schema, Dimension
• BI Reporting Systems
• Data Visualization
• Data Analysts
• “BI Lite”
Any Dimensional, Hierarchical Queries
Easier, Faster
54. TH TechnologyTH Technology
Transitioning Your Data
• KNOW YOUR DATA
• PLAN
• Star Schema, Constraints
• Dimensions
• Hierarchies
• Let SQL Developer Help
• Test, Timing, Test, Test
56. TH TechnologyTH Technology
Analytic Views
• Simpler SQL for Analytic Queries
• Best Performance Gain over Star
Schema, In Memory
• SQL Dev QuickStart
• Faster Route to Data Viz, BI,
“BI-Lite” Implementations
59. TH TechnologyTH Technology
Resources
• Analytic Views LiveSQL Demos
https://livesql.oracle.com/apex/livesql/file/tutorial_EDVE861IID1QUD1NIUPU5ALEW.html
• Analytic Views in SH Sample Schema
https://livesql.oracle.com/apex/livesql/file/tutorial_EDVE861IJ168OTUP6ZZ
01MX84.html
• Analytic View Support in SQL Developer
https://www.thatjeffsmith.com/archive/2017/03/oracle-database-12c-release-2-
analytic-views-sql-developer/
• Using Analytic Views
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r2/Analyti
cViews/UsingAVs.html#overview
60. TH TechnologyTH Technology
Analytic Views
• “Hierarchical / Dimensional
Model Over the Dimension and
Fact Tables of a Star Schema …”
• Best Performance
• Star Schema, In Memory
• W MViews, MViews In Memory