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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Join by <strong>SQL</strong>DB<br />

Join by <strong>SQL</strong>DB<br />

For queries that include joins issued in FOR EACH and OPEN QUERY statements, the<br />

<strong>Data</strong><strong>Server</strong> evaluates the queries and in some cases instructs the MS <strong>SQL</strong> <strong>Server</strong> data<br />

source to per<strong>for</strong>m the joins. A join per<strong>for</strong>med by the data source, called a join by<br />

<strong>SQL</strong>DB, can improve per<strong>for</strong>mance; however, you receive the associated query results<br />

in an order consistent with the data source, not with the <strong>OpenEdge</strong> database. To get<br />

results that are consistent with the <strong>OpenEdge</strong> database, turn off JOIN–BY–<strong>SQL</strong>DB,<br />

either with the QUERY–TUNING phrase at the query level or with the <strong>Server</strong> Join<br />

(-nojoinbysqldb) startup parameter when you compile. If the order of returned<br />

records is important to your application, specify a sort order on the query.<br />

For each join, the <strong>Data</strong><strong>Server</strong> evaluates whether the MS <strong>SQL</strong> <strong>Server</strong> data source can<br />

per<strong>for</strong>m it and estimates whether doing so improves per<strong>for</strong>mance. To determine<br />

whether a join by <strong>SQL</strong>DB is possible, the <strong>Data</strong><strong>Server</strong> assesses whether the following<br />

criteria are true:<br />

• All tables in the join are in the same logical <strong>OpenEdge</strong> database; that is, they are<br />

contained in the same <strong>Data</strong><strong>Server</strong> schema.<br />

• Every table, except the innermost one, has a unique record identifier (ROWID or<br />

RECID support).<br />

• The query does not include a USING phrase <strong>for</strong> any of the inner tables. For<br />

example, a join by <strong>SQL</strong>DB will not occur <strong>for</strong> this query:<br />

FOR EACH customer, EACH order OF customer USING order.ordernum:<br />

• The query does not include a BY phrase that contains expressions or array fields.<br />

• The query does not include a request <strong>for</strong> an EXCLUSIVE-LOCK on any of the tables<br />

in the join.<br />

• There is no nested FOR block in any of the tables in the join.<br />

• The join does not exceed 10 levels.<br />

To estimate whether per<strong>for</strong>ming a join by the data source might improve per<strong>for</strong>mance,<br />

the <strong>Data</strong><strong>Server</strong> assesses whether these additional criteria are true:<br />

• The join uses an OF clause or a WHERE clause <strong>for</strong> each of the inner table loops. For<br />

example, the following query requires a field-to-field correspondence between two<br />

tables:<br />

FOR EACH customer, EACH order OF customer:<br />

• The WHERE clause includes either an operator or the AND option. The following<br />

example includes the equals (=) operator:<br />

FOR EACH customer, EACH order<br />

WHERE customer.custnum = order.custnum:<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> 175

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

Saved successfully!

Ooh no, something went wrong!