This page last changed on Feb 26, 2008.
You can obtain a query plan for any function in your data service. Simply select the Query Plan tab and select a function, just as you would in Test View. In addition, as a convenience, you can obtain an ad hoc query plan for XQuery or SQL.
The interface for Query Plan View is quite similar to that used for testing your query functions. You select a function or procedure from a drop down list and then click the Show Query Plan button.
A query plan identifies the following query components:
There are several ways that a query plan can be viewed:
The query plan shows both informational and warning messages. When a section of the plan is flagged with a warning, the plan segment is highlighted in red. If you mouse over the segment, the warning message appears.
Informational messages also can appear with plan segments. Such segments are highlighted in yellow.
There are two right-click options associated with query plans:
The default file name for the saved file will appear in the form:
If you right-click on the root element of the plan, Plan A right-mouse option on the root element in the plan allows you to print a query plan to a printer or a file. Right-click on any node in the plan and select either the print or print to a file option.
If you print to a file the filename will be of type XML. The name of the file will be the function name followed by the letters _qp, as in: getCustomerView_qp.xml
You can load a previously saved query plan using the following steps:
The selected query plan will be appear.
Assume a query returns data related to order details after it is passed an order ID and a customer ID.
The following is a "pseudocode" description of the query:
for electronic orders matching CustomerID and OrderID
The statements represent mappings or projections in the data service. This can be useful when trying to trace performance issues.
The join conditions are identified in the plan as a left-outer join driven by a complex parameter. By definition, joins have left and right sides, each of which can contain additional joins. One of the best uses of the query plan is to see how the query logic works up the various data threads to return results.
Two options are available in Query Plan:
When you show a query plan for a particular function, you may notice red or yellow highlighting of particular routines. These correspond to warnings or informational messages from the plan interpreter. For example, if a for statement is missing a where clause (potentially leading to slow performance or retrieval of a massive amount of data) a red warning will appear adjacent to the statement. Simply mouse-over the highlighted section of the plan to view the information or warning.
|Document generated by Confluence on Apr 28, 2008 15:57|