From 72b06d455c6bd55ebab57e0491ff9069f82ce48a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Aug 2004 16:37:13 +0300 Subject: WL#1724 "Min/Max Optimization for Queries with Group By Clause" - after-review changes - merged with the source tree from 204-08-27 mysql-test/r/distinct.result: Different plans due to group-by optimization. sql/ha_myisam.cc: More general interface to key_copy. sql/handler.cc: More general interface to key_copy. sql/item.cc: New method to collect all Item_field objects. Used by Item::walk. sql/item.h: Several methods to collect different kinds of items from expression trees. Used by Item::walk. sql/item_sum.cc: Added helper to collect Item_sum objects. sql/item_sum.h: Methods to collect and test Item_sum objects. sql/key.cc: More general interface to key_copy and key_restore. sql/mysql_priv.h: More general interface to key_copy and key_restore. sql/opt_range.cc: Complete implementaion of WL#1724 "Min/Max Optimization for Queries with Group By Clause". sql/opt_range.h: Complete implementaion of WL#1724 "Min/Max Optimization for Queries with Group By Clause". sql/opt_sum.cc: simple_pred is re-used in opt_range.cc sql/sql_acl.cc: More general interface to key_copy and key_restore. sql/sql_handler.cc: More general interface to key_copy. sql/sql_insert.cc: More general interface to key_copy. sql/sql_select.cc: Changes to hook the new QUICK_GROUP_MIN_MAX_SELECT due to two differences from all other quick selects: 1) This quick select may be created (and used) even if there is no WHERE clause. Several places assumed that a QUICK_SELECT is constructed only if there is a WHERE clause, which had to be changed so that QUICK_GROUP_MIN_MAX can be used. 2) Unlike all other quick selects, this QUICK_GROUP_MIN_MAX_SELECT operates for GROUP BY queries. Since for the caller the quick select already produces one result tuple per group, there is no need to call end_send_group, instead we have to call end_send as for a regular quick select. sql/sql_select.h: simple_pred is re-used in opt_range.cc --- sql/sql_handler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_handler.cc') diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 0df3d617d7f..7cde9ef3907 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -333,7 +333,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, send_error(thd,ER_OUTOFMEMORY); goto err; } - key_copy(key, table, keyno, key_len); + key_copy(key, table->record[0], table->key_info + keyno, key_len); err=table->file->index_read(table->record[0], key,key_len,ha_rkey_mode); mode=rkey_to_rnext[(int)ha_rkey_mode]; -- cgit v1.2.1