List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:June 20 2001 7:43pm
Subject:Re: Testing MySQL 4.0
View as plain text  
Hi!

>>>>> "Paul" == Paul Cadach <paul@stripped> writes:

Paul> Hi one time more,
>> As I remember I forget to attach my current patch for sub-selects (for now
>> it's mostly for sql_yacc.yy).

Paul> Mailing list strips attachments... :(((

I got it, and I will comment on this shortly.

>> > Paul> 1) How to store sub-selects in expression? My view is to create
>> > Paul> Item_subselect class and store select's parameters there, then
>> convert it to
>> > Paul> single value/set of values/temptable when running query and this
>> > Paul> optimization is possible (i.e. when sub-query doesn't have
>> cross-references
>> > Paul> to parent's tables/query)
>> >
>> > Yes, this should be ok.

Paul> One more thing is to convert regular select to return Item_select which with
Paul> send results:
Paul> 1) directly to network;
Paul> 2) into temporary table (located in memory for tiny tables and disk-based
Paul> for huge tables).

I don't think you really need to do that.
You can already do the same thing with the current code.

Check the select_result class in sql_class.h and sql_class.cc; This
enables the result of a select be direct to different places.

I think we should be able to do this without any big changes in
the mysql_select() interface.

In other words:

- Break up the mysql_select() function in sql/sql_select.cc into
  pieces.

- Create a new mysql_select() function with almost the same parameters
  as the old one, but using the pieces.

- Code item_select() to use the pieces.

- It should not be that hard to be able to refer to tables outside
  the sub select from the inside of the sub select.

If you can break up mysql_select() into sub-pieces (init, execute...)
and get this to work again, I can probably help you with some of the
things that will come up.

Whenever you got stuck, just email me a test case and a patch from
your prevous version and I will help you with fixing the problem!

Paul> So select will be more regular and will be re-usable for sub-selects (when
Paul> results always sends to temporary table). Or, for example, Item_select sends
Paul> results directly to network if its root query (i.e. doesn't have parent
Paul> query)  or into temporary table and returns "handle" to this table.

Please check out the select_result class;  I am 90 % sure that this
should be able to handle.

Regards,
Monty


Thread