Obtaining the hash key from the SQL text

A hash key is generated based on a statement’s text, and acts as an approximate key for the search mechanism in the statement cache. Since other MDA tables display the statement’s text with lengths exceeding MDA_SQLTEXTLEN in multiple rows, and monCachedStatement does not display the text of the SQL command, the hashkey can be used as an approximate key to look up these tables.

For information about viewing an the entire SQL text of a cached statement, see “Displaying text and parameter information for cached statements”.

Adaptive Server version 15.0.2 provides two functions to compute the hashkey effectively. Use the parse_text function to verify the validity of the SQL text before computing the hash key. The syntax is:

char* parse_text(char *sqltext, int prm_opt)

Valid values for the prm_opt option are:

Use the HASH function to compute the hash key over the statement’s text. For example:

select HASH('xor32', 'select * from syskeys')