- Brad Gall SQL

Using BI Techniques for Database Statistics
Presented by
Brad Gall
A little about me
• BI Consultant with Pragmatic Works
• Before Consulting I did Corporate IT for
many years
▫ Systems Engineer, DBA, Business
• I’ve been working with SQL Server and
SharePoint for over 10 years
• Email: [email protected]
• New Blog: bradgallsql.com
• Twitter: @bradgallsql
What are we talking about today
• Today we’ll look at a real world example of using Microsoft Business
Intelligence to report on SQL DBA Data
• This is something I did when I was working as a DBA and wanted to
▫ A: get some reports on my databases
▫ B: learn some of the cool new tools from Microsoft in the process
• Familiar Data to most of us
• Good end to end example of Self Service BI
• Part 1: Dimensional Modeling Techniques and Terminology
▫ Dimensional Modeling 101
▫ How does this apply the our DBA Data
• Part 2 (Demo): DBA statistic queries
▫ Dmv queries
▫ Queries to Load Dimensional Model “DBA Data Mart”
• Part 3 (Demo): “DBA Data Mart” reporting
▫ Load Data into PowerPivot
▫ Report with PivotTables
Dimensional Modeling 101
• Kimball Data Warehousing
• 2 Types of Tables
▫ Dimensions (Attributes) … what do I want to “slice by”
▫ Facts (Metrics) …what do I want to measure
• Dimension tables contain attributes
that your users will use to slice and
analyze metrics
• In a STAR schema, the Dimension
tables are flattened (denormalized)
• Related attributes are grouped
together into tables (some art some
science to this)
• Keep attributes together in a table that
you want to put into a Hierarchy
• Fact tables contain your “numbers”
• These are the rows we’ll aggregate
• Transaction Fact Tables
▫ Should be modeled at the lowest
granularity that we need to analyze
▫ Should also be modeled so that the
measures are SUM-able across all
“grains” (Dimension tables)
▫ Should have a “narrow” physical
structure (only keys and metrics)
What are our Facts and Measures
• Facts
▫ FactIndexGrowth
▫ FactIndexUsage
 Seeks and Scans
▫ FactCachedQueryStats
 Executions
 LogicalReads
▫ FactWaitStats
 WaitCounts
 SignalWaitTime
• Dimensions
▫ DimIndex
 DatabaseName
 TableName
 IndexName
▫ DimStoredProcedures
▫ DimDate
▫ DimTime
Star Schema
Typical Data Life Cycle
• Stage Data from Source
• Transform Data (Cleanse and
• Load Into Relational Data Warehouse
tables (Dimensional Model)
• Load Data into SSAS database from
Relational Dimensional Model
• Analytic Report Tools Built on OLAP
Demo “Data Life Cycle”
• Query our DMVs (“stage”)
• “Transform” our data in stored
• Insert data into “DBA Data Mart”
• Load Data into PowerPivot (SSAS)
• Analyze Data with Excel Pivot Table
(Power View report if time)
DMVs used
• sys.dm_db_index_usage_stats
• sys.dm_db_partition_stats (Index Sizes)
• sys.dm_os_wait_stats
• Stored Procedure Stats
▫ sys.dm_exec_query_stats
▫ sys.dm_exec_sql_text
▫ sys.dm_exec_cached_plans
• Good blog on these views Stratesql.com
PowerPivot and Pivot Tables
• Built in to Excel 2013 (Add-in)
• Self-Service Version of Analysis
Services Tabular (similar to SQL
• Uses xVelocity Engine to compress
and store data in Memory
• Excel Pivot Tables and Pivot Charts
read PowerPivot Model
(drag and drop interface)
• Scripts and files available on my blog

similar documents