List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:November 7 2001 2:57am
Subject:Re: MySQL design doc, and some question.
View as plain text  
Hi!

>>>>> "Feng" == Feng Tian <ftian@stripped> writes:

Feng> On Tue, 6 Nov 2001, Sinisa Milivojevic wrote:
Feng> Hi,

Feng> Thanks alot for the prompt answering.  In case of lacking
Feng> an overall document,
 
Feng> 1. Is there anything describing the table type/handler?  
Feng> I am particularly interested in this module because I may 
Feng> need to write my own table format.

Take a look at the interface in

ha_handler.h

For an example of how to do this, take a look at
ha_berkeley.h and ha_berkeley.cc

Feng> 2. Is there anything describing the catalog and how optimizer
Feng> uses catalog?

When you create a table, MySQL creates a .frm file that contains the
field and key specifications.  The table handler code is responsible
to create those files it needs.

To understand the table object, take a look at the structs/classes in
table.h and field.h

Feng> 3. I found I can force the join order by
Feng> using the "straight" option.  Is there anyfor me to force
Feng> a join algorithm?  For example,

Feng> select * from A, B where A.a = B.b

As we only have a 2 ways to do the join, there isn't any reason to
be able to force it ?

Feng> Can I force a sort-merge join instead of using nested loops?

No, because we don't yet have a sort-merge.
We have on the todo to do a hash-merge, but we haven't had time to do
that yet.

Feng> If there is no such "force plan" mechanism, how hard if I 
Feng> want to modify the optimizer to do this?

This should be rather simple.
The functions to change would probably be (in sql_select.cc):

make_join_statistics()
get_best_combination()
make_join_readinfo()

and then do a function to handle the new join method that would be
called from 

(*join_tab->next_select)

The JOIN_TAB structure is defined in sql/sql_select.h

Regards,
Monty
Thread
bk commit into 4.0 treearjen6 Nov
  • MySQL design doc, and some question.Feng Tian6 Nov
    • Re: MySQL design doc, and some question.Sinisa Milivojevic6 Nov
      • Re: MySQL design doc, and some question.Feng Tian6 Nov
        • Re: MySQL design doc, and some question.Michael Widenius7 Nov
      • Re: MySQL design doc, and some question.Michael Widenius7 Nov