← Back to team overview

maria-developers team mailing list archive

an observation



by playing with the code I think I found something interesting.

My environment: MariaDB 10.0.10, MyISAM-engine

I played with a table-scan, no index is defined on this table. When I
execute a SQL-statement that forces the server to do a second table-
scan on a table this 2nd table-scan will be slow. 

The reason for this behaviour is the usage of a buffer: during the 1st
scan this buffer is filled, used and filled again until the whole table
is processed. At the end of the 1st scan it contains the last bytes of
the file. When a 2nd scan is started the reading of the table starts
from the beginning of the file but the buffer and all associated
variables are not reset:  the buffer still contains the bytes from the
end of the file, the request cannot be fulfilled by the buffer so the
request has to be handled by reading the bytes directly from the file
 using the read()-function of the Std-library. This takes much more
time then simply copying the bytes from the internal buffer.

My idea is: somewhere in the code this situation must be detected and
the buffer (and all associated variables) reset to initial values. rein
it_io_cache() looks like the right candidate for this.

I assume the engine Maria will show the same effect (I didn't check
other engines).

Some questions: is my observation correct? Do you think this needs to
be fixed? Or is there no further development on this part of the code?



PS: you will find more details on this topic here: http://augustq.blogs

Attachment: signature.asc
Description: This is a digitally signed message part

Follow ups