DataDirect XQuery®'s SQL Adaptors were designed with a strong emphasis on performance and scalability. As a result, applications
written with DataDirect XQuery® usually perform better than applications written using JDBC and an XML API. The best way to convince
yourself of this is to test DataDirect XQuery® in your own environment — but you might want to know some of the reasons you will be impressed by our performance.
- We know how to measure performance. Our performance test suites are extensive, and represent a major development effort.
These suites are run regularly as part of our standard release cycle. When our support staff identifies interesting customer
performance scenarios, these are added to our performance test suites.
- We use highly selective SQL queries to retrieve no more data than we need for a query, carefully analyzing an XQuery for
all conditions that can be used to limit the data needed. We retrieve only the rows needed in the query results, and only the
columns needed within those rows. Some XQuery implementations retrieve much more data, filtering out unneeded data in the XQuery
engine — this significantly hurts performance.
- Operations that can be done in SQL are pushed into the database. This is particularly important for joins, order by clauses, and SQL functions.
- Each database has its own SQL adaptor, which takes an XQuery and generates SQL specifically for that database. The SQL we generate
is optimized for each database based on the results of our performance testing. Some XQuery implementations support only one database;
others generate the same SQL regardless of the database involved, a strategy that simply can not offer optimal performance.
- We use lazy evaluation so that streaming APIs like SAX, StAX, or output streams can retrieve data as soon as it is available.
As data is needed, we retrieve it incrementally from JDBC result sets.
- Because XML is hierarchical, we use SQL generation algorithms that are optimized for building XML hierarchies. We make extensive
use of merge-joins when translating XQuery to SQL. And the added cost of XML construction, which can be considerable in some implementations, is negligible in ours.
- Users can control several aspects of SQL generation through pragmas defined in the XQuery, which can significantly improve the performance in some cases.
- The underlying database drivers can significantly affect performance. As the leading vendor of JDBC, ODBC, and ADO.NET drivers,
DataDirect knows how to make drivers perform. And because we control both the XQuery implementation and the underlying drivers,
we can add optimizations to the drivers to support our implementation.