Specifying SQL Generation Algorithms

The algorithms DataDirect XQuery® uses to create hierarchies are optimal for creating large, complex documents, but still good for smaller documents with shallower hierarchies. If query results contain four or fewer levels of hierarchy, and your performance seems inadequate, you will sometimes get better performance if you tell DataDirect XQuery® to use either outer join or sorted outer union (see the DataDirect 2.0 User's Guide and Reference for details on these algorithms). There are several ways to specify SQL generation algorithms in DataDirect XQuery®:

Example 18. Specifying SQL Generation Algorithms

The algorithm can be specified via the XQJ API:


    XQDataSource ds = new DDXQDataSource(); 
    ds.setJdbcPragmas("sql-rewrite-algorithm=nested-loop");          
            

The algorithm can be specified with an entry in the source configuration file:

    <pragma name="sql-rewrite-algorithm">outer-join</pragma>      
            

The algorithm can be specified in the XQuery prolog with a declaration option:

    declare option ddtek:sql-rewrite-algorithm "outer-join";                
            

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!