Limit the Size of Schema Query Parameters and Literals

field consumes the same number of bytes as the length of the value. A string value consumes twice as many bytes as the length of the value. These sizes are similar to what is described in the Sun StorageTek 5800 System Administration Guide, Table 7-6, Number of Bytes Used by Each Element Type in a Schema Table.

For example, assume dynamic parameter 1 is bound to string "Hello" in the query system.test.type_string=?. The parameter length would then be 12 bytes: 2 bytes overhead plus 10 bytes for a 5-character string parameter.

Conversely, note that in the query system.test.type_string like ’%Hello%’ that the parameter is 16 bytes: 2 bytes overhead plus 14 bytes for a 7 character string regardless of the declared size of the system.test.type_string field in the schema.

For the query system.test.type_date = {date ’2007-01-1’} AND

system.test.type_char=’Hello’, the parameter length is 13 bytes: 2 bytes overhead for each of two query values plus 4 bytes for a date literal plus 5 bytes for a 5-character char parameter.

Limit the Size of Schema Query Parameters and Literals

When designing a schema, limit the sizes of fields so that planned queries will fit within the size limits. Most simple queries on a single table will fit within the 8000-byte limit. This is because the table row definition itself must fit within the similar 8080-bytes for overall table row size. Also note that complex queries on even a single table (such as queries involving many OR clauses) may overflow the limit. Schema design and query design must work together carefully if complex queries are an important part of the application.

For further information, see “Query Size Limit” on page 127.

Limit Results Per Fetch

Queries should use a reasonable value of “results per fetch” when a large total result set size is expected. The maximum result size should not exceed the memory allocated for the query engine on the server side. If it does, then the query will fail. Dropping the query result size will allow the query to succeed.

If you incorrectly estimate how much memory will be used by the result set, the server will not fail gracefully with an appropriate error message, but will instead run out of memory.

Suggested values are in the 2000-5000 range. Set maxFetchSize = 4098 as an argument to the query method.

128

Sun StorageTek 5800 System Client API Reference Manual • June 2008

Page 128
Image 128
Sun Microsystems 5800 manual Limit the Size of Schema Query Parameters and Literals, Limit Results Per Fetch