From 4be0bfad98c41acb6a2a7d5722051081ab5d239a Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 28 Dec 2022 16:42:27 +0200 Subject: Simplified code in generate_derived_keys() and when using pos_in_tables Added comments that not used keys of derivied tables will be deleted. Added some comments about checking if pos_in_table_list is 0. Other things: - Added a marker (DBTYPE_IN_PREDICATE) in TABLE_LIST->derived_type to indicate that the table was generated from IN (list). This is useful for debugging and can later be used by explain if needed. - Removed a not needed test of table->pos_in_table_list as it should always be valid at this point in time. --- sql/sql_show.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sql/sql_show.cc') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a716cae6955..05d0f601434 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8899,6 +8899,10 @@ bool optimize_schema_tables_reads(JOIN *join) tab; tab= next_linear_tab(join, tab, WITH_BUSH_ROOTS)) { + /* + The following is true for the temporary table that will hold the + final result. + */ if (!tab->table || !tab->table->pos_in_table_list) continue; @@ -8970,6 +8974,10 @@ bool get_schema_tables_result(JOIN *join, tab; tab= next_linear_tab(join, tab, WITH_BUSH_ROOTS)) { + /* + The following is true for the temporary table that will hold the + final result. + */ if (!tab->table || !tab->table->pos_in_table_list) break; -- cgit v1.2.1