Samples Tutorial

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Understanding Query Plans

A query plan contains detailed, functional-level information about an XQuery. Reviewing the Query Plan is the first step in troubleshooting a data service function's performance bottlenecks, as it lets you view the query's construction.

 


Objectives

After completing this lesson, you will be able to:

 


Overview

The most common reason for viewing a query plan is to review the SQL statement generated by the ALDSP query engine. However, the query plan also displays the following information for the physical data sources to be called during the query:

Physical Data Source
Information Provided

Relational

Data source name, actual SQL calls, and join parameters.

Web Services

Data source name, operation(s) called, and join parameters.

Custom Functions

Function name and join parameters.

XML and Delimited Files .

Filename

In addition, the following information is displayed for all functions:

 


26.1 Viewing the Query Plan

A query plan is generated for each data service function, when a ALDSP project is built.

Objectives

In this exercise, you will:

Instructions

  1. Open XQueries.ds in Query Plan View.
  2. Select getTop10Customers() from the function drop down list.
  3. Click Show Query Plan. The query plan opens in tree view, as displayed in Figure 26-1.
  4. Figure 26-1 Query Plan as a Tree Structure


    Query Plan as a Tree Structure

  5. Click the XML button to view the Query Plan as an XML document.
  6. Figure 26-2 Query Plan as an XML Document


     Query Plan as an XML Document

  7. Click the Text button to view the Query Plan as a text document.
  8. Figure 26-3 Query Plan as a Text Document


    Query Plan as a Text Document

 


26.2 Locating the SQL Statement in a Query Plan

SQL statements are generated for functions that call relational databases.

Objectives

In this exercise, you will:

Instructions

  1. Open the Query Plan as an XML document.
  2. Expand the FLWOR nodes until you see the #cdata-section. This is the SQL statement for the query.
  3. Figure 26-4 Query Plan View of SQL Statements


     Query Plan View of SQL Statements

As a reminder, this function retrieves customer and order amount information. In addition, the result set is ordered in descending order by order amount.

 


26.3 Locating XML Elements

XML elements identify the data that will be returned by the query function. Each XML element is identified with a QName.

Objectives

In this exercise, you will:

Instructions

  1. In Query Plan View, expand the return node.
  2. Notice all the XML elements that will be returned when the function is executed.
  3. Figure 26-5 Query Plan View of XML Elements


     Query Plan View of XML Elements

 


Lesson Summary

In this lesson, you learned how to:


  Back to Top       Previous  Next