In-memory evaluation of row filters
Starting in release 10.2.1, Q Capture is able to evaluate simple filters for search conditions or log record variables in-memory, rather than through the database engine. Traditionally, evaluation through the database engine can incur a higher cost for high volume workloads. Evaluating in-memory allows both CPU savings and reduced contention with the DBMS, and also reduces the potential for a bottleneck to arise when publishing changes.
Both search conditions and change conditions are eligible to be evaluated in-memory. The following operators are supported:
- Basic comparison operators:
- =, <>, <, <=, >, >=
- [NOT] LIKE
- [NOT] BETWEEN
- IS [NOT] NULL
- Boolean/logical operators:
- AND, OR, NOT
- Functions:
- IN(in_value1 [, … n])
- TRIM(string_value1)
- SUBSTR(string_value, startpos, len)
- MOD(numeric-expression-1,numeric-expression-2)
- REPLACE(source-string,search-string,relace-string)
- Conditional operators:
- Searched CASE statement. For
example,
CASE WHEN boolean_expression THEN result_expression [ … n ] ELSE else_result_expression END
- Searched CASE statement. For
example,
- INTEGER, SMALLINT, BIGINT
- CHAR, VARCHAR
- TIMESTAMP
- $OPERATION
- $AUTHID
- $AUTHTOKEN (DB2® z/OS®)
- $PLANNAME (DB2 for z/OS)
- $PARTITION (DB2 for z/OS)
- $APPL_ID (DB2 for Linux, UNIX, and Windows)
- $APPL_NAME (DB2 for Linux, UNIX, and Windows)
If a syntax error is detected, ASN7295W is issued when the expression is parsed by Q Capture. Some expressions that are provided might be too complex for the in-memory evaluator to parse (for example, expressions that contain a subselect). In this case, the engine falls back to evaluating through the database. This error is indicated with the ASN7296I message.
You can also specify to run all filters through the database by running Q Capture with the parameter IN_MEM_FILTER_EVAL=N (the default is Y).
Table 1 provides examples of filters that can be evaluated in memory.
IBMQREP_SUBS.SEARCH_CONDITION | IBMQREP_SUBS.CHANGE_CONDITION | Resulting expression that is evaluated in-memory by Q Capture |
---|---|---|
:FIRSTNAME IN (‘JANE’, ‘BOB’) | NULL | WHERE :USERNAME IN ('JANE', 'BOB') |
NULL | TRIM($PLANNAME) <> ‘ASNQAPP’ | WHERE TRIM($PLANNAME) <> ‘ASNQAPP’ |
NULL | $PLANNAME IN (‘A’, ‘B’, ‘C’) | WHERE $PLANNAME IN (‘A’, ‘B’, ‘C’) |
NULL | ($AUTHID <> ‘JONO’ OR $PLANNAME LIKE ‘ASN%’) AND $OPERATION = ‘I’ | WHERE ($AUTHID <> ‘JONO’ OR $PLANNAME LIKE ‘ASN%’) AND $OPERATION = ‘I’ |
:STATE LIKE ‘CA%’ | NULL | WHERE :STATE LIKE ‘CA%’ |
:FIRSTNAME IN (‘JANE’, ‘BOB’) | $AUTHID = ‘DBUSER1’ | WHERE (:FIRSTNAME IN (‘JANE’, ‘BLOB’)) AND ($AUTHID = ‘DBUSER1’) |