List:Internals« Previous MessageNext Message »
From:Kathryn Steinbrink Date:June 12 2008 4:00pm
Subject:mean_rec_length
View as plain text  
Hello,
This post regards the mean_rec_length that is returned by a storage engine
in the info() method.  The returned value is expected to be the 'average
record length for the table'.

For a new storage engine I am developing,
for tables that do not contain variable length fields or LOBs, the value
for this stat is no problem; the record length is fixed.  However, for
records that do have a variable length and/or LOB field, my storage engine
does not know the average record length.  It cannot simply divide the file
size by the number of records to determine the average record length.
(There are preallocations and auxilary storage considerations that make it
more complex for my storage engine, and these factors are unavailable to
the storage engine.)

My storage engine does know the maximum record length, and the length of
the fixed portion of the record. (The fixed portion includes an optional
ALLOCATE length, which is a creation time attribute that specifies the
'normal' or default length of the field for my storage engine.)

Looking at the MySQL source, it appears that sql_select.cc uses the
mean_rec_length for caching purposes during joins, but I don't understand
the full scope of its usage.
Can you please advise me on what value to return for the mean_rec_length?
Is it better for my storage engine to return the fixed length of the
record, the maximum record length, or something else?

Kathy Steinbrink

Thread
mean_rec_lengthKathryn Steinbrink12 Jun
  • Re: mean_rec_lengthSergei Golubchik23 Jun