From 2a7cf59fc92ce322671bb687e2941275dd23d1c5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 31 Oct 2006 17:31:56 -0800 Subject: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Allocation of memory for the sort buffer at each evaluation of a subquery may take a significant amount of time if the buffer is rather big. With the fix we allocate the buffer at the first evaluation of the subquery and reuse it at each subsequent evaluation. mysql-test/r/subselect.result: Added a test case for bug #21727. mysql-test/t/subselect.test: Added a test case for bug #21727. sql/item_subselect.h: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Added an implementation for Item_subselect::is_uncacheable() returning TRUE if the engine if the subselect is uncacheable. sql/mysql_priv.h: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Added a new boolean parameter to the filesort_free_buffers procedure. If the value of this parameter is TRUE the procedure frees the sort_keys buffpek buffers. sql/records.cc: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Added a new boolean parameter to the filesort_free_buffers procedure. If the value of this parameter is TRUE the procedure frees the sort_keys buffpek buffers. sql/sql_base.cc: Fixed bug #21727. Made sure that st_table::pos_in_table_list would be always initialized. sql/sql_select.cc: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Added a new boolean parameter to the filesort_free_buffers procedure. If the value of this parameter is TRUE the procedure frees the sort_keys buffpek buffers. sql/sql_show.cc: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Added a new boolean parameter to the filesort_free_buffers procedure. If the value of this parameter is TRUE the procedure frees the sort_keys buffpek buffers. sql/sql_table.cc: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Cleanup. sql/table.cc: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Added st_table_list::in_subselect() returning for a table the subselect that contains the FROM list this table is taken from (if there is any). sql/table.h: Fixed bug #21727. This is a performance issue for queries with subqueries evaluation of which requires filesort. Added fields for sort_keys and buffpek buffers to the FILESORT_INFO structure. --- sql/item_subselect.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sql/item_subselect.h') diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 45df4f3880d..1a8111069e6 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -114,6 +114,7 @@ public: single select and union subqueries only. */ bool is_evaluated() const; + bool is_uncacheable() const; /* Used by max/min subquery to initialize value presence registration @@ -428,3 +429,9 @@ inline bool Item_subselect::is_evaluated() const return engine->is_executed(); } +inline bool Item_subselect::is_uncacheable() const +{ + return engine->uncacheable(); +} + + -- cgit v1.2.1