Free Newsletters:
DatabaseDaily  
Database Journal
Search Database Journal:
 
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum DBA Videos
internet.com

» Database Journal Home
» DBA Videos
» Database Articles
» Database Tutorials
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» DBA Jobs
» Sitemap

News Via RSS Feed



follow us on Twitter

Marketplace Partners
Be a Marketplace Partner

internet.commerce
Be a Commerce Partner


















Mariposa Bot Shipped With Vodafone Smartphone

IT Job Market Heating Up: Report

Bing Makes Strides But Momentum Stalls

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Database Journal | DBA Support | SQLCourse | SQLCourse2







Related Articles
Introduction to SQL Server 2000 Analysis Services: Creating Our First Cube
Introduction to SQL Server 2000 Analysis Services: Working with Dimensions
Introduction to SQL Server 2000 Analysis Services: Handling Time Dimensions

PROGRAMMER ANALYST (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume

Featured Database Articles

MS SQL

July 10, 2006

Introduction to the Analysis Services 2005 Query Log

By William Pearson

Overview of the Query log

Structure and Operation of the Query Log

As we have seen in other articles, and have emphasized in the sections above, the Query Log lies at the heart of Usage Analysis for the Analysis Services Database and some of its child objects, including cubes. As we have also previously noted, the Query Log captures details about the queries that have been enacted upon the server by client applications. We have prepared the Query Log for examination in this section, having selected the creation and maintenance of the MSSQL Server table incarnation versus the file option, which we mentioned was possible in passing earlier.

A study of the MSSQL Server table, which we named ANSYS049_MSASQueryLog, reveals some differences over its counterpart in the previous version of MSSQL Server Analysis Services. Unlike its SQL Server Analysis Services 2000 predecessor (by default an MS Access database named msmdqlog.mdb), we can name the Query Log table whatever we direct in the Properties settings for the Analysis Server under consideration, and begin with an MSSQL Server table (rather than converting an MS Access table to one) as we saw above.

A look at the ANSYS049_MSASQueryLog table reveals the nature of the data within the Query Log. Let's look at the layout of the table from SQL Server Management Studio, before examining its contents on a more specific basis.

1.  From within Object Explorer, right-click the ANSYS049_MSASQueryLog table (housed within the Tables folder of the AdventureWorksDW relational database, as we saw earlier).

2.  Select Modify from the context menu that appears, as shown in Illustration 30.


Illustration 30: Opening the ANSYS049_MSASQueryLog Table Schema ...

The ANSYS049_MSASQueryLog table schema appears on a new Browser tab (adjacent to the Adventure Works [Browse] tab we opened earlier), within the SQL Server Management Studio, as depicted in Illustration 31.


Illustration 31: The ANSYS049_MSASQueryLog Table Schema

As we noted in Usage-Based Optimization in Analysis Services 2005, the Usage-Based Optimization Wizard relies upon the Query Log to support its operations. As we can see, the log is composed of several relatively straightforward fields. The fields, together with their respective descriptions, are summarized in Table 1.

Field

Description

MSOLAP_Database

The name of the Analysis Services database used in the query

MSOLAP_ObjectPath

The name of the cube used in the query

MSOLAP_User

The name of the user that ran the query

Dataset

A numeric string indicating the level from each dimension used to satisfy the query

StartTime

The time the query began

Duration

The length of time (in seconds) of the query execution

Table 1: The Fields of the Query Log

In lockstep with a review of the fields from a description perspective, we can view the actual data in the table from the SQL Server Management Studio, as well.

3.  From the Object Explorer, right-click the ANSYS049_MSASQueryLog table, once again.

4.  Select Open Table from the context menu that appears, as shown in Illustration 32.


Illustration 32: Opening the ANSYS049_MSASQueryLog Table ...

The ANSYS049_MSASQueryLog table appears on another new Browser tab (adjacent to the tabs we have already opened), within the SQL Server Management Studio, as partially depicted in Illustration 33.


Illustration 33: Partial View of the ANSYS049_MSASQueryLog Table

Each of the fields has significant potential, with regard to analysis and reporting utility. I have even created cubes from this table, which, coupled with performance, sizing and other such information from various sources, can support all manner of administrative and similar analysis. The fourth column, Dataset, can be highly useful with regard to the specific information that it reveals about cube usage. The somewhat cryptic records within this column represent the associated levels accessed for each dimensional hierarchy within the query. An example of the Dataset field appears (enclosed in a red rectangle), within a subset of a sample row, as shown in Illustration 34.


Illustration 34: Example of the Dataset Field

While we won't go into a detailed explanation in this lesson, I expect to publish a prospective article that outlines the interpretation of the digits in the Dataset field (we will trace an example Dataset field's component digits to their corresponding components in the respective cube structure), along with more information regarding report writing based upon the Query Log in general. Our purpose here is more to expose general options for using the Query Log directly to generate customized usage analysis reports.

Additional fields provide rather obvious utility in analyzing cube usage, together with performance in general. The fields present information which, particularly in combination with Dataset, helps us to report precisely on the exact points at which queries interact with the cube. These combinations can provide excellent access and "audit" data. To some extent, they can confirm the validity of cube design if, say, a developer wants to verify which requests, collected during the business requirements phase of cube design, are actually valid, and which, by contrast, might be considered for removal from the cube structure based upon disuse, should the time arrive that we wish to optimize cube size and performance by jettisoning little-used data.

StartTime and Duration provide the ingredients for evolved performance trending (via relational reports, OLAP reports, KPIs assembled from either or both, and more), and act as useful statistics upon which to base (or filter) numerous types of administrative reports, including information that will help us to plan for heavy reporting demands and other cyclical considerations.

Customizing Query Log Capture

As we have seen, the usage-based analysis and optimization processes provided via the Usage-Based Optimization Wizard perform their functions based upon statistics captured in the Query Log. From within the Analysis Server Properties dialog box, which contains options that control user interfaces, server environment, processing, logging, and add-ins, we can make the query logging process more frequent than the default of one-in-every-ten queries, as we saw earlier. Moreover, from the Properties settings, we can:

  • Stop and start logging (we can leave it stopped entirely, if we desire);
  • Clear, idle or restart the log;
  • Create a new "prospective" log, while retaining its predecessor for archiving, etc.;
  • Change the logging interval.

We have also mentioned that we can further manage the automatic logging of processing messages by directing the server to enable the logging of the messages to a log file for which we can designate a file path and name.

While setting the logging interval too low might degrade performance in a busy production environment, the logging interval setting for a development environment might typically be a lower number than 10. This would obviously allow us to capture more voluminous statistics to support intensive analysis of cube performance and use, prior to optimizing it for final delivery to information consumers. To cite an example of the utility of lowering the Sampling Rate that most of us might find intuitive, a fairly straightforward approach to optimizing performance based on usage is to create partitions with zero aggregations, adjust query logging to log every query for a period of time to capture typical usage patterns, and then use the Usage-Based Optimization Wizard to design aggregations appropriate to the usage. Once this is done, we can likely afford to raise the Sampling Rate frequency again, to lower the overhead inherent in its use.

5.  Exit SQL Server Management Studio when ready.

Now that we have a basic understanding of the workings of the Query Log, we will discuss options for producing customized reports to meet our business needs.

Direct Reporting for Sophisticated Utilization Analysis

As many of us probably can see, we can rely upon the fact that the options for reporting choices for cube utilization analysis are plentiful, whether we maintain the Query Log in an MSSQL relational table or a file, as we have discussed, or otherwise move / transform the data, and house it in an administrative reporting warehouse / mart, or some other such arrangement. We will find that many common packages can be used in identical fashion to report from these stores via ODBC and other channels. I have even created cubes (both for Analysis Services and other popular OLAP cubes) for larger clients from the statistical information regarding cube usage, together with statistics that come from other diagnostic sources, generating robust and useful mechanisms for tracking cube usage and performance from many perspectives. (I expect to publish articles that detail more of the specifics of some of these administrative database and reporting options, in later articles in this series, as well as my MSSQL Server Reporting Services series, here at Database Journal).

Regardless of the reporting application, the concepts are essentially the same in reporting from the Query Log. The general steps include the following:

  • Establishment of a connection to MSSQL Server, and the database containing the Query Log table (or a connection to the respective location of the data if it has been housed elsewhere);
  • Creation of a query / dataset against the data source;
  • Creation of a report or other layout file within which to accumulate / present the selected data;
  • Publication / deployment of the report / other layout in a manner whereby it becomes accessible to the intended audience(s).

As I have stated, our "medium" for reporting can be selected from a wide array of applications. I have created similar reporting processes in the past using a wide range of business intelligence tools, including MSSQL Server Reporting Services, Cognos, Business Objects, Crystal Reports, ProClarity, MicroStrategy, and Microsoft Office, among other less common tools.

Because reporting typically entails more than the mere entrainment of the data from the Query Log, for use in a report or reports within any of a multiple choice of applications, we will not be able to examine report writing and formatting considerations, aggregating the data in the report or elsewhere, etc., in this article. Many of us will know the steps required to create robust and attractive reports within our own choices of solutions. Other of my articles elsewhere deal with the specifics of working with various reporting options. The demand is evident, in discussions with my clients and readers, for the capability to trend cube performance, create user access reports, and so forth, and I will focus later on some of those needs, together with ways to meet them. I will attempt to accomplish this over the months to come, with different reporting tools after we have exposed other components of the statistical data source, of which the Query Log is only a part.

Summary ...

In this article, we introduced the general need for more sophisticated analysis based upon usage analysis statistics that we can collect surrounding our Analysis Services cubes. Our primary focus was a closer examination of the source of Analysis Services Database (and predominantly cube) performance statistics, the Query Log, discussing its location and physical structure, how it is populated, and other characteristics.

We first created a copy of a sample Analysis Services database for use in our practice exercise, and then enabled the Analysis Server Query Log to capture query statistics. We then processed our cube, before manipulating data to create Query Log entries, to complete preparation for our overview of the Query Log.

We next moved into the focus of our session, examining the Query Log contents, discussing the various statistics captured. Finally, we discussed reporting possibilities, commenting on both relational and OLAP options. As a part of our exploration of Query Log statistics capture, we touched upon various means of customizing Query Log capture to meet local needs.

» See All Articles by Columnist William E. Pearson, III

Discuss this article in the MSSQL Server 2000 Analysis Services and MDX Topics Forum.

Introduction to MSSQL Server Analysis Services Series
Part 88: Introduction to Security in Analysis Services
Part 87: Cube Storage: Planning Partitions from a SQL Server Management Studio Perspective
Part 86: Cube Storage: Planning Partitions (Business Intelligence Development Studio Perspective)
Part 85: Cube Storage: Introduction to Partitions
Part 84: Introduction to Cube Storage
Part 83: Attribute Discretization: Customize Grouping Names
Part 82: Attribute Discretization: Using the “Clusters” Method
Part 81: Attribute Discretization: Using the “Equal Areas” Method
Part 80: Attribute Discretization: Using the Automatic Method
Part 79: Introduction to Attribute Discretization
Part 78: More Exposure to Settings and Properties in Analysis Services Attribute Relationships
Part 77: Attribute Relationships: Settings and Properties
Part 76: Introduction to Attribute Relationships in MSSQL Server Analysis Services
Part 75: Attribute Member Values in Analysis Services
Part 74: MSSQL Analysis Services - Attribute Member Names
Part 73: Attribute Member Keys – Pt 2: Composite Keys
Part 72: Attribute Member Keys – Pt 1: Introduction and Simple Keys
Part 71: Dimension Attributes: Introduction and Overview, Part V
Part 70: Dimension Attributes: Introduction and Overview, Part IV
Part 69: Dimension Attributes: Introduction and Overview, Part III
Part 68: Dimension Attributes: Introduction and Overview, Part II
Part 67: Dimension Attributes: Introduction and Overview, Part I
Part 66: Dimensional Model Components: Dimensions Part II
Part 65: Dimensional Model Components: Dimensions Part I
Part 64: Manage Unknown Members in Analysis Services 2005, Part II
Part 63: Manage Unknown Members in Analysis Services 2005, Part I
Part 62: Alternatively Sorting Attribute Members in Analysis Services 2005
Part 61: Introduction to Linked Objects in Analysis Services 2005
Part 60: Distinct Counts in Analysis Services 2005
Part 59: Positing the Intelligence: Conditional Formatting in the Analysis Services Layer
Part 58: Administration and Optimization: SQL Server Profiler for Analysis Services Queries
Part 57: Mastering Enterprise BI: Time Intelligence Pt. II
Part 56: Mastering Enterprise BI: Time Intelligence Pt. I
Part 55: Design and Documentation: Introducing the Visio 2007 PivotDiagram
Part 54: Actions in Analysis Services 2005: The URL Action
Part 53: Actions in Analysis Services 2005: The Drillthrough Action
Part 52: Mastering Enterprise BI: Introducing Actions in Analysis Services 2005
Part 51: Mastering Enterprise BI: Introduction to Translations
Part 50: Mastering Enterprise BI: Introduction to Perspectives
Part 49: Introduction to the Analysis Services 2005 Query Log
Part 48: Mastering Enterprise BI: Working with Measure Groups
Part 47: Mastering Enterprise BI: Introduction to Key Performance Indicators
Part 46: Mastering Enterprise BI: Extend the Data Source with Named Calculations, Pt. II
Part 45: Mastering Enterprise BI: Extend the Data Source with Named Calculations, Pt. I
Part 44: Process Analysis Services Objects with Integration Services
Part 43: Usage-Based Optimization in Analysis Services 2005
Part 42: Named Sets Revisited
Part 41: Migrating an Analysis Services 2000 Database to Analysis Services 2005
Part 40: Introducing Data Source Views
Part 39: Reporting Options for Analysis Services Cubes: MS Excel 2003 and More ...
Part 38: Mastering Enterprise BI: Create Aging "Buckets" in a Cube
Part 37: Mastering Enterprise BI: Relative Time Periods in an Analysis Services Cube, Part II
Part 36: Mastering Enterprise BI: Relative Time Periods in an Analysis Services Cube
Part 35: Process Analysis Services Cubes with DTS
Part 34: Presentation Nuances: CrossTab View - Same Dimension
Part 33: Point-and-Click Cube Schema Simplification
Part 32: Manage Distinct Count with a Virtual Cube
Part 31: Distinct Count Basics: Two Perspectives
Part 30: Semi-Additive Measures and Periodic Balances
Part 29: Performing Incremental Cube Updates - An Introduction
Part 28: Partitioning a Cube in Analysis Services - An Introduction
Part 27: Basic Storage Design
Part 26: Derived Measures vs. Calculated Measures
Part 25: Creating a Dynamic Default Member
Part 24: Another Approach to Local Cube Design and Creation
Part 23: Introduction to Local Cubes
Part 22: Actions in Virtual Cubes
Part 21: Putting Actions to Work in Regular Cubes
Part 20: Reporting Options for Analysis Services Cubes: ProClarity Part II
Part 19: Reporting Options for Analysis Services Cubes: ProClarity Professional, Part I
Part 18: Using Calculated Cells in Analysis Services , Part II
Part 17: Using Calculated Cells in Analysis Services, Part I
Part 16: MSAS Administration and Optimization: Toward More Sophisticated Analysis
Part 15: MSAS Administration and Optimization: Simple Cube Usage Analysis
Part 14: Build a Web Site Traffic Analysis Cube: Part II
Part 13: Build a Web Site Traffic Analysis Cube: Part I
Part 12: Reporting Options for Analysis Services Cubes: Cognos PowerPlay
Part 11: Reporting Options for Analysis Services Cubes: MS FrontPage 2002
Part 10: Reporting Options for Analysis Services Cubes: MS Excel 2002
Part 9: Drilling Through to Details: From Two Perspectives
Part 8: Custom Cubes: Financial Reporting - Part II
Part 7: Custom Cubes: Financial Reporting
Part 6: Exploring Virtual Cubes
Part 5: Working with the Cube Editor
Part 4: Parent-Child Dimensions
Part 3: Handling Time Dimensions
Part 2: Working with Dimensions
Part 1: Creating Our First Cube


Go to page: Prev  1  2  3  4  5  

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

MS SQL Archives








Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
Inner and outer select mussab 2 March 10th, 04:16 AM
SQL server 2008 in windows 7 pro problem theresatan 2 March 6th, 08:35 PM
code for re-build index and shrink db or file? mib 7 March 5th, 08:50 AM
sql maintenance plan fails database missing tbrownch 3 February 24th, 08:53 AM









The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers