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.

<strong>Data</strong>base design issues<br />

restrictions. While the server's CLOB-style definition may contain character data that exceeds<br />

30,000 bytes, only approximately 30,000 bytes of that data can be retrieved and manipulated by<br />

the CHARACTER data type in ABL client. If the server data associated with a CLOB-style server<br />

definition is represented by UCS-2 character data in double-byte <strong>for</strong>mat, then the 30,000 /byte/<br />

restriction on the CHAR data type also becomes an approximately 15,000 /character /restriction<br />

in the Uniocde-enabled ABL client.<br />

Indexes and sorting<br />

You create and maintain all indexes from within the MS <strong>SQL</strong> <strong>Server</strong> data source using native<br />

tools, rather than with the <strong>Data</strong> Dictionary. A data source index uses a logical pointer to the<br />

physical locations of table rows in order to sequence data access. You can add and drop indexes<br />

but you cannot use their names in queries. The data source alone ultimately decides when and<br />

how to use indexes; its decisions are not affected by the <strong>Data</strong><strong>Server</strong>.<br />

Give careful consideration to benefit and cost of creating indexes. Having indexes <strong>for</strong> frequently<br />

executed queries can greatly improve record retrieval per<strong>for</strong>mance. An abundance of unused or<br />

infrequently used indexes can have a negative impact on per<strong>for</strong>mance due to the overhead cost<br />

of maintaining the indexes.<br />

Using index definitions in the MS <strong>SQL</strong> <strong>Server</strong> data source, the <strong>Data</strong><strong>Server</strong> builds index<br />

in<strong>for</strong>mation in the schema holder. <strong>OpenEdge</strong> index definitions <strong>for</strong> the data source schema serve<br />

two purposes:<br />

1. They allow you to use the OF option in ABL with the FOR EACH and FIND statements. Using<br />

the OF option improves the readability of your code. The OF keyword is equivalent to the<br />

<strong>SQL</strong> WHERE clause. You can use OF only when you have a field of the same name in two<br />

tables and the field is an index in at least one of the tables. There<strong>for</strong>e, since the custnum<br />

field is common to both the order and customer tables, you could write the following<br />

statement:<br />

FOR EACH order OF customer:<br />

2. They translate USE–INDEX to <strong>SQL</strong> ORDER BY <strong>for</strong> <strong>Data</strong><strong>Server</strong> operations. A MS <strong>SQL</strong> <strong>Server</strong><br />

data source uses the ORDER BY clause to assist in selecting the optimal index <strong>for</strong> the query.<br />

For example, if you define city-dept as a MS <strong>SQL</strong> <strong>Server</strong> data source primary key on the<br />

city and department fields, it is a unique index in the schema holder. In this case, the<br />

following <strong>OpenEdge</strong> statements are equivalent when accessing the data source:<br />

FOR EACH employee USE-INDEX city-dept:<br />

FOR EACH employee BY city BY department:<br />

Note: If you do not specify a USE-INDEX or BY clause, your query will return records in an<br />

unpredictable order. If your application requires a predictable order, use include a<br />

USE-INDEX or BY clause.<br />

2–11

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

Saved successfully!

Ooh no, something went wrong!