13.01.2013 Views

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

OpenEdge Data Management: DataServer for Microsoft SQL Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Query tuning<br />

Table 24: Query-tuning options (4 of 4)<br />

Option Description<br />

SELECT-ON-JOIN When per<strong>for</strong>ming an outer join operation,<br />

SELECT-ON-JOIN specifies that any search<br />

condition separate from the join predicate be<br />

bracketed after the join is per<strong>for</strong>med. This option<br />

eliminates all the records with NULL values<br />

contained in the non-matching results, if the<br />

columns with the NULL values appear in the join<br />

search criteria.<br />

JOIN-ON-SELECT When per<strong>for</strong>ming an outer join operation,<br />

JOIN-ON-SELECT specifies that any search<br />

condition separate from the join predicate be<br />

bracketed be<strong>for</strong>e the join is per<strong>for</strong>med. This<br />

option includes all the records with NULL values<br />

contained in the non-matching results and<br />

causes records that join on NULL to be included<br />

in the results of an OUTER-JOIN which is<br />

consistent with <strong>OpenEdge</strong> join handling of the<br />

unknown value.<br />

Note: JOIN-ON-SELECT is the default behavior<br />

<strong>for</strong> outer join operations.<br />

All but two of the QUERY–TUNING options take effect at both compile time and run time.<br />

The exceptions are JOIN–BY–<strong>SQL</strong>DB and NO–JOIN–BY–<strong>SQL</strong>DB, which apply only at<br />

compile time. You can override query-tuning defaults (except JOIN–BY–<strong>SQL</strong>DB) at<br />

run-time by specifying the appropriate startup parameters.<br />

The following example shows how to use the QUERY–TUNING phrase to enhance<br />

per<strong>for</strong>mance. It includes a join, JOIN-BY-<strong>SQL</strong>DB, that the <strong>Data</strong><strong>Server</strong> instructs the MS<br />

<strong>SQL</strong> <strong>Server</strong> data source to per<strong>for</strong>m by default, as shown:<br />

FOR EACH customer, EACH order OF customer WHERE order.ordernum GT 20<br />

BY customer.custnum QUERY-TUNING (JOIN-BY-<strong>SQL</strong>DB)<br />

The QUERY–TUNING options in this example specifies the following:<br />

• Lookahead cursors are not used (the NO–LOOKAHEAD option)<br />

• The <strong>Data</strong><strong>Server</strong> writes an extended report on the <strong>SQL</strong> statements that it executes<br />

(the DEBUG EXTENDED option)<br />

When the <strong>Data</strong><strong>Server</strong> constructs queries <strong>for</strong> a MS <strong>SQL</strong> <strong>Server</strong> data source, it uses the<br />

QUERY–TUNING options that you specify as guidelines. This is because there might be<br />

syntax considerations that prevent the <strong>Data</strong><strong>Server</strong> from applying the QUERY–TUNING<br />

options as specified. In such a case, the <strong>Data</strong><strong>Server</strong> executes the query using the most<br />

appropriate options.<br />

Note: The <strong>Data</strong><strong>Server</strong> does not issue errors or warnings if it does not apply the<br />

QUERY–TUNING options that you specify.<br />

<strong>OpenEdge</strong> <strong>Data</strong> <strong>Management</strong>: <strong>Data</strong><strong>Server</strong> <strong>for</strong> <strong>Microsoft</strong> <strong>SQL</strong> <strong>Server</strong> 173

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!