From 709a0a131021135e9fb7a2095fcfcbc223dfb126 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Wed, 26 May 2010 13:18:18 -0700 Subject: MWL#106: Backport optimizations for derived tables and views. The main consolidated patch. --- sql/sql_class.h | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'sql/sql_class.h') diff --git a/sql/sql_class.h b/sql/sql_class.h index 4388f26c0ce..5bb52c74750 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1474,6 +1474,9 @@ public: */ TABLE_LIST *emb_on_expr_nest; } thd_marker; + + bool prepare_derived_at_open; + #ifndef MYSQL_CLIENT int binlog_setup_trx_data(); @@ -2810,12 +2813,12 @@ public: class select_union :public select_result_interceptor { -protected: - TMP_TABLE_PARAM tmp_table_param; public: + TMP_TABLE_PARAM tmp_table_param; TABLE *table; + ha_rows records; - select_union() :table(0) { tmp_table_param.init(); } + select_union() :table(0), records(0) { tmp_table_param.init(); } int prepare(List &list, SELECT_LEX_UNIT *u); bool send_data(List &items); bool send_eof(); @@ -2823,7 +2826,9 @@ public: virtual bool create_result_table(THD *thd, List *column_types, bool is_distinct, ulonglong options, - const char *alias, bool bit_fields_as_long); + const char *alias, + bool bit_fields_as_long, + bool create_table); }; /* Base subselect interface class */ @@ -2885,9 +2890,11 @@ protected: public: select_materialize_with_stats() {} - virtual bool create_result_table(THD *thd, List *column_types, - bool is_distinct, ulonglong options, - const char *alias, bool bit_fields_as_long); + bool create_result_table(THD *thd, List *column_types, + bool is_distinct, ulonglong options, + const char *alias, + bool bit_fields_as_long, + bool create_table); bool init_result_table(ulonglong select_options); bool send_data(List &items); void cleanup() @@ -3175,7 +3182,7 @@ public: class multi_update :public select_result_interceptor { TABLE_LIST *all_tables; /* query/update command tables */ - TABLE_LIST *leaves; /* list of leves of join table tree */ + List *leaves; /* list of leves of join table tree */ TABLE_LIST *update_tables, *table_being_updated; TABLE **tmp_tables, *main_table, *table_to_update; TMP_TABLE_PARAM *tmp_table_param; @@ -3201,7 +3208,7 @@ class multi_update :public select_result_interceptor bool error_handled; public: - multi_update(TABLE_LIST *ut, TABLE_LIST *leaves_list, + multi_update(TABLE_LIST *ut, List *leaves_list, List *fields, List *values, enum_duplicates handle_duplicates, bool ignore); ~multi_update(); -- cgit v1.2.1