List:Internals« Previous MessageNext Message »
From:Paul Cadach Date:June 21 2001 12:12pm
Subject:Re: Testing MySQL 4.0
View as plain text  
Hi,

> 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.

Thanks for very useful information.

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

As I can see in sql_parse.cc, mysql_select() calls 4 times with next
arguments:
1) thd (always);
2) tables (or tables->next in CREATE/INSERT queries);
3) select_lex->item_list (fields list);
4) select_lex->where (where clause);
5) select_lex->ftfunc_list (full-text search functions);
6) (ORDER *)select_lex->order_list.first (or UNLL in multi_delete;
expressions in order clause);
7) (ORDER *)select_lex->group_list.first (or NULL in multi_delete;
expressions in group clause);
8) select_lex->having (or NULL in multi_delete; having clause);
9) (ORDER *)lex->proc_list.first (or NULL in multi_delete; procedure clause;
2Sinisa: may be this needs to be moved from lex to select_lex?);
10) select_lex->options | thd->options (| SELECT_NO_JOIN_CACHE in
multi_delete);
11) result.

As you can see 7/8 out of 11 arguments uses select_lex. May be to pass just
select_lex structure to mysql_select instead of those many arguments (this
also will help Sinisa to handle select_lex->next inside mysql_select() for
UNIONs)?

> In other words:
>
> - Break up the mysql_select() function in sql/sql_select.cc into
>   pieces.

As I can see not cross-referenced sub-queries can be handled by existing
mysql_select() function. May be to try with existing then split it because
spliiting is very hard for me (at least for now, without good knowelege of
MySQL internals).

> - 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.


Trying...

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

Yep.

> 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.

I want to go some diffirent way - code sub-select related Item_, etc then
split mysql_select() because I don't have enough knowelege of MySQL
internals to do this work now.


WBR,
Paul.


Thread