List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:October 7 2009 8:27pm
Subject:Re: understanding handler::read_time and handler::scan_time
View as plain text  
Hi, Zardosht!

On Oct 07, Zardosht Kasheff wrote:
> Hello,
> 
> I would like to make sure that I understand the meaning of the
> functions handler::scan_time and handler::read_time. Both are to be
> estimates of the cost of doing some operations on a table.
> 
> handler::scan_time estimates the cost of doing a full table scan.
> handler::read_time estimates the cost of reading some number of rows
> from some number of ranges in an index (assumed to be a non-covering
> index).
> 
> The estimates requested are meant to be disk seeks.
> 
> I have gathered this from reading comments in different handler implementations.
> 
> The questions that I need help on are the following:
> 1) Is my understanding above accurate?

Yes. At least it matches mine :)

> 2) Does the absolute value returned affect the query plan, or is it
> the relative value between these two functions?

I'm afraid that absolute values matter. And the the units of
scan_time/read_time are quite arbitrary and there's no normalization
procedure that would help to select them correctly :(

I suppose that other engines simply tweak these numbers until they get
satisfactory query plans.

Regards / Mit vielen Grüßen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring
Thread
understanding handler::read_time and handler::scan_timeZardosht Kasheff7 Oct
  • Re: understanding handler::read_time and handler::scan_timeSergei Golubchik7 Oct
    • Re: understanding handler::read_time and handler::scan_timeZardosht Kasheff7 Oct
      • Re: understanding handler::read_time and handler::scan_timeZardosht Kasheff8 Oct
        • Re: understanding handler::read_time and handler::scan_timeMichael Widenius8 Oct
        • Re: understanding handler::read_time and handler::scan_timeSergei Golubchik8 Oct
          • Re: understanding handler::read_time and handler::scan_timeZardosht Kasheff8 Oct
            • Re: understanding handler::read_time and handler::scan_timeSergei Golubchik8 Oct
      • Re: understanding handler::read_time and handler::scan_timeSergei Golubchik8 Oct
      • Re: understanding handler::read_time and handler::scan_timeMichael Widenius8 Oct