diff options
author | unknown <konstantin@mysql.com> | 2005-06-24 22:48:12 +0400 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-06-24 22:48:12 +0400 |
commit | 97e78d60177b7e06040827902a9a91bc3d104c9d (patch) | |
tree | a6dbfc1e4e6641ad6c82d0862eb8c4c0004a5e29 /sql/sql_select.h | |
parent | b80eb2b5a83ad7e1ad8fbca7cb94030b3297a3e0 (diff) | |
download | mariadb-git-97e78d60177b7e06040827902a9a91bc3d104c9d.tar.gz |
- don't call JOIN::join_free(1) twice for every join in JOIN::cleanup().
The reason it happened was that both, JOIN::cleanup() and JOIN::join_free(),
went over all nested joins and called cleanup/join_free for them.
For that:
- split recursive and non-recursive parts of JOIN::cleanup() and
JOIN::join_free()
- rename JOIN::cleanup to JOIN::destroy, as it actually destroys its
argument
- move the recursive part of JOIN::cleanup to st_select_lex::cleanup
- move the non-recursive part of JOIN::join_free to the introduced
method JOIN::cleanup().
sql/sql_lex.h:
Add st_select_lex::cleanup, a counterpart of st_select_lex_unit::cleanup()
sql/sql_select.cc:
- remove two unused arguments from return_zero_rows
- split JOIN::join_free and JOIN::cleanup to recursive and non-recursive
parts.
- note, the assert in JOIN::join_free _does_ fail in having.test.
We have two options: a) propagate `full' flag to the nested joins.
We did it before, and this patch didn't change it. If so, we
can end up cleaning up an uncacheable JOIN (that is, the join that
we might need again).
b) evaluate own 'full' flag on every level. In this case, we might
end up with tables freed in mysql_unlock_read_tables, but not
cleaned up properly, and this may be even worse. The test suite
passes with both approaches, but not with the assert.
sql/sql_select.h:
- declarations for JOIN::cleanup() and JOIN::join_free()
sql/sql_union.cc:
Add st_select_lex::cleanup, a counterpart of st_select_lex_unit::cleanup():
move the recursive part of JOIN::cleanup to it.
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r-- | sql/sql_select.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h index e5266944251..d88fbbfc73f 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -325,7 +325,7 @@ class JOIN :public Sql_alloc int optimize(); int reinit(); void exec(); - int cleanup(); + int destroy(); void restore_tmp(); bool alloc_func_list(); bool make_sum_func_list(List<Item> &all_fields, List<Item> &send_fields, @@ -349,7 +349,15 @@ class JOIN :public Sql_alloc int rollup_send_data(uint idx); int rollup_write_data(uint idx, TABLE *table); bool test_in_subselect(Item **where); + /* + Release memory and, if possible, the open tables held by this execution + plan (and nested plans). It's used to release some tables before + the end of execution in order to increase concurrency and reduce + memory consumption. + */ void join_free(bool full); + /* Cleanup this JOIN, possibly for reuse */ + void cleanup(bool full); void clear(); bool save_join_tab(); bool send_row_on_empty_set() |