Hello! If there’s anyone who can help with this problem…
We created two working environments, creating the same table (TABLEX), same indexes (INDEX1, INDEX2 & INDEX3) and executing the same SQL Statements (SQL1, SQL2 & SQL3) thru spufi. Here is exactly what we did.
For both environments, these SQL statements were created. The ‘where clause’ of the first SQL statement is patterned after INDEX1. The ‘where clause’ of the second SQL statement is patterned after INDEX2. The ‘where clause’ of the third SQL statement is patterned after INDEX3.
Environment 1: We created three indexes (INDEX1, INDEX2 & INDEX3). Then we ran SQL1, this ran for 5 seconds and TMONDB2 displayed INDEX1. Then we ran SQL2, this ran for 5 seconds and TMONDB2 displayed INDEX2. Then we ran SQL3, this also ran for 5 seconds and TMONDB2 displayed INDEX3.
Environment 2: At first, we did not create any index, then we ran the three SQLs. SQL1 ran for 28 seconds, SQL2 for 26 seconds and SQL3 for 30 seconds.
Then we created INDEX3. SQL1 ran for 38 seconds, TMONDB2 displayed INDEX3. SQL2 ran for 28 seconds, TMONDB2 displayed INDEX3. SQL3 ran for 5 seconds, TMONDB2 displayed INDEX3.
Then we created INDEX2. So, we now have INDEX2 & INDEX3. SQL1 ran for 26 seconds, TMONDB2 displayed INDEX2 & INDEX3. SQL2 ran for 28 seconds, TMONDB2 displayed INDEX2 & INDEX3. SQL3 ran for 9 seconds, TMONDB2 ONLY displayed INDEX3.
Then we created INDEX1. Now, we have all indexes. SQL1 ran for 7 seconds, TMONDB2 displayed INDEX1. SQL2 ran for 58 seconds, TMONDB2 displayed INDEX1. SQL3 ran for 41 seconds, TMONDB2 displayed INDEX1.
The following are the SQL statements:
1. SELECT *
FROM TABLEX
WHERE BANKCD = 12345
AND MONTHENDDT = 20070131
AND BATCHSYS = ‘SYS’
AND ACCTCD = 123
2. SELECT *
FROM TABLEX
WHERE BANKCD = 12345
AND BATCHSYS = ‘SYS’
AND CLIENT = 12345
AND ACCTCD = 123
AND MONTHENDDT = 20070131
3. SELECT *
FROM TABLEX
WHERE MONTHENDDT = 20070131
AND UNIT = 5423
AND ACCTOFF = 111112
AND BATCHSYS = ‘SYS’
Why is the runtime of environment 2 different from environment 1 when all the indexes are created? Why is the display of TMONDB2 different from environment 1 and environment 2 after creating the three indexes? What could be the other factors that may affect this difference?
We created two working environments, creating the same table (TABLEX), same indexes (INDEX1, INDEX2 & INDEX3) and executing the same SQL Statements (SQL1, SQL2 & SQL3) thru spufi. Here is exactly what we did.
For both environments, these SQL statements were created. The ‘where clause’ of the first SQL statement is patterned after INDEX1. The ‘where clause’ of the second SQL statement is patterned after INDEX2. The ‘where clause’ of the third SQL statement is patterned after INDEX3.
Environment 1: We created three indexes (INDEX1, INDEX2 & INDEX3). Then we ran SQL1, this ran for 5 seconds and TMONDB2 displayed INDEX1. Then we ran SQL2, this ran for 5 seconds and TMONDB2 displayed INDEX2. Then we ran SQL3, this also ran for 5 seconds and TMONDB2 displayed INDEX3.
Environment 2: At first, we did not create any index, then we ran the three SQLs. SQL1 ran for 28 seconds, SQL2 for 26 seconds and SQL3 for 30 seconds.
Then we created INDEX3. SQL1 ran for 38 seconds, TMONDB2 displayed INDEX3. SQL2 ran for 28 seconds, TMONDB2 displayed INDEX3. SQL3 ran for 5 seconds, TMONDB2 displayed INDEX3.
Then we created INDEX2. So, we now have INDEX2 & INDEX3. SQL1 ran for 26 seconds, TMONDB2 displayed INDEX2 & INDEX3. SQL2 ran for 28 seconds, TMONDB2 displayed INDEX2 & INDEX3. SQL3 ran for 9 seconds, TMONDB2 ONLY displayed INDEX3.
Then we created INDEX1. Now, we have all indexes. SQL1 ran for 7 seconds, TMONDB2 displayed INDEX1. SQL2 ran for 58 seconds, TMONDB2 displayed INDEX1. SQL3 ran for 41 seconds, TMONDB2 displayed INDEX1.
The following are the SQL statements:
1. SELECT *
FROM TABLEX
WHERE BANKCD = 12345
AND MONTHENDDT = 20070131
AND BATCHSYS = ‘SYS’
AND ACCTCD = 123
2. SELECT *
FROM TABLEX
WHERE BANKCD = 12345
AND BATCHSYS = ‘SYS’
AND CLIENT = 12345
AND ACCTCD = 123
AND MONTHENDDT = 20070131
3. SELECT *
FROM TABLEX
WHERE MONTHENDDT = 20070131
AND UNIT = 5423
AND ACCTOFF = 111112
AND BATCHSYS = ‘SYS’
Why is the runtime of environment 2 different from environment 1 when all the indexes are created? Why is the display of TMONDB2 different from environment 1 and environment 2 after creating the three indexes? What could be the other factors that may affect this difference?
Comment