Example of a Query Plan

The example query plan shown in Figure 324 provides information about how DataDirect XQuery translates the following query, which accesses one relational data source, into a SQL Select statement and how XML results are constructed.

declare option ddtek:plan-explain 'format=xhtml'; 
<myHoldings> { 
for $holdings in collection("pubs.dbo.holdings")/holdings 
where $holdings/userid = "Minollo" 
return <holding 
quantity="{$holdings/shares}">{$holdings/stockticker/text()}</holding> 
} 
</myHoldings> 

In the following query plan, notice how the Relational Data Source node includes details about the SQL Select statement, as well as information about how the result ($PT) is constructed.

Figure 324. Example of a Query Plan Displayed in the XQuery Editor

 
Free Stylus Studio XML Training: