List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:September 8 2004 9:16am
Subject:Re: Bitwise opperators and table_map
View as plain text  
Hi!

On Sep 07, Katsikaros Vangelis wrote:
> Sergei Golubchik wrote:
> >On Aug 24, Vagelis Katsikaros wrote:
> >
> Item::used_tables returns the tablemap of the tables used by the 
> item.

Right.

> join_tab::key_dependent of a table A stores the tables that are 
> joined with A using a primary key.

Any key, I believe - it's set in add_key_field():

      /*
        Save the following cases:
        Field op constant
        Field LIKE constant where constant doesn't start with a wildcard
        Field = field2 where field2 is in a different table
        Field op formula
        Field IS NULL
        Field IS NOT NULL
        Field BETWEEN ...
        Field IN ...
      */
      stat[0].key_dependent|=used_tables;

> What is stored in join_tab::dependent?

You may see that it's set in make_join_statistics(),
tableB->dependent=tableA, when tableA must be before tableB in the join
order, because of outer join or because of straight join.

> In table::map is stored the ID bit of the table (1,2,4,8,...,), that 
> is, the place of the table in the bit map?

Yes.

> From what I've seen the key_map (Bitmap<64> Template) is just 
> another bit map with bitwise-related functions built-in.

Yes. In 4.0 it was the same ulong as table_map, but later we wanted to
allow more than 32 keys per table, so I changed key_map to be an
arbitrary-length bitmap. It's 64 bits (ulonglong) by default, but can be
compiled to use larger bitmaps. Eventually we'll change table_map to use
the same template.
 
Regards,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
/_/  /_/\_, /___/\___\_\___/  Osnabrueck, Germany
       <___/  www.mysql.com
Thread
Bitwise opperators and table_mapVagelis Katsikaros24 Aug
  • Re: Bitwise opperators and table_mapSergei Golubchik2 Sep
    • Re: Bitwise opperators and table_mapKatsikaros Vangelis7 Sep
      • Re: Bitwise opperators and table_mapSergei Golubchik8 Sep