Selecting Data

To minimize data retrieval, DataDirect XQuery® generates very selective SQL, returning only the data that is needed for a given XQuery. To avoid retrieving rows that are not needed, the conditions in Where clauses and predicates are converted to Where clauses in the generated SQL. To avoid retrieving columns that are not needed, the generated SQL specifies the columns actually needed to evaluate the XQuery. Some XQuery implementations retrieve much more data than is actually needed, which significantly hurts performance.

Example 1. Where Clause Pushdown

In this example, the SQL query generated by DataDirect XQuery® returns only the rows that are actually needed for the XQuery.

XQuery (with Where clause)

for $h in collection('HOLDINGS')/HOLDINGS
where $h/SHARES < 10000
return $h/USERID

XQuery (with predicate)

for $h in collection('HOLDINGS')/HOLDINGS[SHARES < 10000]
return $h/USERID

Generated SQL (for both forms of the XQuery)

SELECT ALL
nrm4."USERID" AS RACOL1
FROM
"PEPPINO"."HOLDINGS" nrm4
WHERE
nrm4."SHARES" < 10000

Example 2. Column Pushdown

The SQL query generated by DataDirect XQuery® retrieves only the columns that are actually needed for the XQuery.

XQuery

for $u in collection('USERS')/USERS
return <user>{$u/FIRSTNAME,$u/LASTNAME}</user>

Generated SQL

SELECT ALL
nrm5."FIRSTNAME" AS RACOL1,
nrm5."LASTNAME" AS RACOL2
FROM
"PEPPINO"."USERS" nrm5

Try DataDirect XQuery® Free!

Put the power, scalability, and performance of DataDirect XQuery® to work for you today! Our free trial lets you see for yourself how easy it is to build data integration applications that access relational, EDI, and other file formats as XML!

Download DataDirect XQuery® today!

Online Video Tutorials!

Our easy-to-follow online video tutorials are a great way to get acquainted with the many features of DataDirect XQuery®.

And if you like what you see, download a free copy today and try DataDirect XQuery® for yourself!

Back to School with DataDirect XQuery®

Getting your mind around the possibilities of a data integration technology as promising as XQuery can be difficult, but our XML developers Webinars will help you understand the power and versatility of XQuery, and our favorite XQuery processor, DataDirect XQuery®.

Stay Informed!

XQuery is one of the hottest XML technologies being developed today. Stay informed with vital news about standards, tools, and trends by signing up for the DataDirect XQuery® newsletter.