Overview of the SQL Query Rewrite Facility

The SQL Query Rewrite facility in SPD Server examines SQL queries in order to optimize processing performance. Some SQL queries contain SQL statements and sub-queries that can be more rapidly evaluated in a separate space, as opposed to sequentially evaluating large blocks of SQL statements. When SPD Server detects and processes SQL statements or sub-queries in a separate space, intermediate result tables are produced. The original SQL query is dynamically rewritten, using intermediate results tables to replace the SQL code that was separately evaluated. The result is a dynamic process that evaluates and processes SQL queries more efficiently.
Inserting the derived intermediate data into the original SQL query does not change the quantitative results; it only expedites the processing that is required to calculate them. The SQL Query Rewrite Facility does not change the content of the query's answer row set. However, the order of the rows in the query answer set might vary if you compare the optimized query answer set with the query answer set SPD Server generates with the SQL Query Rewrite facility disabled.