Hi, Arjen!
On May 25, Arjen Lentz wrote:
>> On May 25, Arjen Lentz wrote:
>>> I mean, if I do a query about 1 table on an information schema
>>> table, then mysqld will first run through all tables in all
>>> databases, prouduce the temporary table of everything (most likely
>>> on disk), and then run my query on it.
>>
>> Depends on the query. If you do a query about 1 table on an
>> information schema table, like, for example, SELECT ... FROM
>> I_S.TABLES WHERE SCHEMA_NAME='d1' AND TABLE_NAME='t1' - MySQL will
>> not run through all tables in all databases. It'll open d1/t1.frm
>> directly. Or may not do even that, for example for SELECT TABLE_NAME
>> FROM ... - it doesn't need to open frm, it's enough to verify that
>> the frm file exists.
>
> Cognitive dissonance for me there.
>
> Is your statement above based on looking at the source code, or a
> presumption of how it works?
It's based on remembering how it used to work, BUG# and WL# with the
task of implementing the above optimization, reviewing the patch, and
looking through the source code briefly few days ago.
Oh, yes, and presumption that I developed after all the above :)
> If the latter, can you please take a peek at the actual code and
> confirm? Thanks
BUG#19588
WL#3732
http://dev.mysql.com/doc/refman/5.1/en/information-schema-optimization.html
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