Hi, Anshu! On Jun 08, Anshu Avinash wrote:
Hi all,
As per serg comments on the previous commit, I have modified the code to add an init function which will initialize all the cost factors at the start of the server. The latest code is at https://github.com/igniting/server/commits/selfTuningOptimizer. I have also attached the diff here.
However, I am still not able to come up with an example for my test case for READ_TIME_FACTOR and SCAN_TIME_FACTOR. I will go through the code again to figure it out. Currently the test case which I have written just gives the workflow: EXPLAIN SELECT ...; Update constant tables directly; Reconnect; EXPLAIN SELECT.
For a simple test case, try something like the following: create table t1 (a int auto_increment primary key, b int); insert t1 (b) values (1),(2),(3),... I think, about 20-30 rows should be enough. explain select t1 where a > 15; it doesn't have to be 15, try to experiment with different constants in the query. Pick the one where 'a > N' gives you a table scan (explain shows 'ALL'), but with 'a > N+1' explain shows 'range'. Now, modify one of your cost factors and try again. explain should change from 'ALL' to 'range'. I'll send a second email soon with my comments about your patch, thanks for attaching it! Regards, Sergei