Hi serg,

I have attached the updated diff. I'm still unable to observe the effect introduced by the cost factors. Maybe I just need to study the usage of scan_time() and read_time() in greater detail.

Regards
Anshu


On Tue, Jun 10, 2014 at 1:19 PM, Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Anshu!

On Jun 10, Anshu Avinash wrote:
> Hi serg,
>
> I have implemented your suggestions. In the test case I created a table
> with 25 rows. Explain for 'select * from t1 where a > 19' gave 'ALL' while
> explain for 'select * from t1 where a > 20' gives range.
> I have also written public methods ha_scan_time() and ha_read_time(). I
> should replace every occurrence of handler::scan_time() with
> ha_scan_time(), right? How do I make sure that I don't miss any place?

See other ha_xxx vs xxx methods, e.g. ha_rnd_init and rnd_init.

You make scan_time() protected - and the compiler won't allow it to be
called outside of the handler class.

> Also regarding making everything in the class Cost_factors static vs
> creating an object and using it everywhere: cann't we use a namespace
> Cost_factors? How is it done usually? I don't see much usage of
> namespaces in the code.

Yes, namespaces aren't used much in MariaDB, but feel free to use them,
if you'd like.

Regards,
Sergei