t***@gmail.com
2015-04-22 15:13:06 UTC
hello all!
We've been doing some benchmark testing to compare using dynamic SQL vs a stored procedure and have come up with a couple questions that we'd like some help with.
we are on version 11.7.FC6 on AIX 6.1 in a HDR environment.....
The test is very simple, we are doing 100,000 executions of the same SQL statement where a single row is returned based on the PK and all columns of the table are returned.
The table is called Customer and its primary key is PK_Customer_ID (ID).
For the dynamic SQL test we run the following 100,000 times:
SELECT ID AS ID1_9_0_, ACTIVE AS ACTIVE7_9_0_, CREATE_DATE AS CREATE8_9_0_,
CREATED_BY AS CREATED9_9_0_, UPDATE_DATE AS UPDATE10_9_0_, UPDATE_VERSION AS UPDATE11_9_0_,
UPDATED_BY AS UPDATED12_9_0_, BILL_TO_IDENT AS BILL2_9_0_, CUSTOMER_IDENT AS CUSTOMER4_9_0_,
CUSTOMER_NAME AS CUSTOMER3_9_0_, PARENT_ID AS PARENT5_9_0_,
PROJECT_IDENT AS PROJECT6_9_0_, SSCC_PREFIX AS SSCC13_9_0_,
SSCC_SEQ_NAME AS SSCC14_9_0_
FROM CUSTOMER AS CUSTOMEREN0_
WHERE ID = ?
For the stored procedure test, we have a stored procedure (batch_run_test) that contains the same query and we call the stored procedure 100,000 times:
{call batch_run_test(?)}
For both tests, the same value of '3' for the bind variable was used for all 100,000 calls.
We collected the isreads and bufreads for the customer table, the pk_customer_id index and the systables.
For the dynamic SQL test:
Customer: 0 isreads, 100000 bufreads
pk_customer_id: 100000 isreads, 100000 bufreads
systables: 101197 isreads, 404158 bufreads
For the stored procedure test:
Customer: 0 isreads, 100000 bufreads
pk_customer_id: 100000 isreads, 100000 bufreads
systables: 75 isreads, 169 bufreads
Our questions are as follows:
1) What exactly are isreads? The book definition says it is a call to the ISAM read function, but what does that really mean in comparison to bufreads?
2) Why does the customer table have 0 isreads but the pk_customer_id index have 100,000 isreads?
3) Why are there such high numbers of reads on systables for the dynamic SQL? Especially the 400,000+ bufreads. The exact same SQL was run every time. Shouldn't this SQL statement have very quickly gone to SQL statement cache and executed from there and avoided additional calls to read systables?
Thanks in advance...........
We've been doing some benchmark testing to compare using dynamic SQL vs a stored procedure and have come up with a couple questions that we'd like some help with.
we are on version 11.7.FC6 on AIX 6.1 in a HDR environment.....
The test is very simple, we are doing 100,000 executions of the same SQL statement where a single row is returned based on the PK and all columns of the table are returned.
The table is called Customer and its primary key is PK_Customer_ID (ID).
For the dynamic SQL test we run the following 100,000 times:
SELECT ID AS ID1_9_0_, ACTIVE AS ACTIVE7_9_0_, CREATE_DATE AS CREATE8_9_0_,
CREATED_BY AS CREATED9_9_0_, UPDATE_DATE AS UPDATE10_9_0_, UPDATE_VERSION AS UPDATE11_9_0_,
UPDATED_BY AS UPDATED12_9_0_, BILL_TO_IDENT AS BILL2_9_0_, CUSTOMER_IDENT AS CUSTOMER4_9_0_,
CUSTOMER_NAME AS CUSTOMER3_9_0_, PARENT_ID AS PARENT5_9_0_,
PROJECT_IDENT AS PROJECT6_9_0_, SSCC_PREFIX AS SSCC13_9_0_,
SSCC_SEQ_NAME AS SSCC14_9_0_
FROM CUSTOMER AS CUSTOMEREN0_
WHERE ID = ?
For the stored procedure test, we have a stored procedure (batch_run_test) that contains the same query and we call the stored procedure 100,000 times:
{call batch_run_test(?)}
For both tests, the same value of '3' for the bind variable was used for all 100,000 calls.
We collected the isreads and bufreads for the customer table, the pk_customer_id index and the systables.
For the dynamic SQL test:
Customer: 0 isreads, 100000 bufreads
pk_customer_id: 100000 isreads, 100000 bufreads
systables: 101197 isreads, 404158 bufreads
For the stored procedure test:
Customer: 0 isreads, 100000 bufreads
pk_customer_id: 100000 isreads, 100000 bufreads
systables: 75 isreads, 169 bufreads
Our questions are as follows:
1) What exactly are isreads? The book definition says it is a call to the ISAM read function, but what does that really mean in comparison to bufreads?
2) Why does the customer table have 0 isreads but the pk_customer_id index have 100,000 isreads?
3) Why are there such high numbers of reads on systables for the dynamic SQL? Especially the 400,000+ bufreads. The exact same SQL was run every time. Shouldn't this SQL statement have very quickly gone to SQL statement cache and executed from there and avoided additional calls to read systables?
Thanks in advance...........