Statement Cache in IDS 9.4
Posted in 2003
Hi,
Apparently SQL statements are not cached by SSC(Shared Statement
Cached) if the 'like' keyword is used. I can change the query to use
the equal sign instead of 'like' and the statement would be cached
(but of course defeats the purpose). The actual query we use is more
extensive that the example I use here, hence caching the query plan
has real significance.
Any insight appreciated.
Thanks.
Example:
#include <stdio.h>
#include <stdlib.h>
main() {
EXEC SQL BEGIN DECLARE SECTION;
long lPassengerCount;
EXEC SQL END DECLARE SECTION;
EXEC SQL connect to 'data_migr_test';
EXEC SQL prepare prePassengerCount from
"select count(*)
from passenger
where passenger_name like ?";
EXEC SQL execute prePassengerCount into :lPassengerCount using
'SMITH%';
printf("Passengers: %lu\\n", lPassengerCount);
EXEC SQL free prePassengerCount;
EXEC SQL disconnect current;
}
Statement Cache Configuration:
STMT_CACHE_HITS 0
STMT_CACHE_NOLIMIT 1
STMT_CACHE 2
STMT_CACHE_SIZE 1048576
IDS 9.4, RedHat Linux 7.3
//ra