1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

SHOW EXPLAIN: merge with 5.5-main

This commit is contained in:
Sergey Petrunya
2012-10-06 11:03:37 +04:00
37 changed files with 4035 additions and 190 deletions

View File

@ -101,6 +101,13 @@ typedef struct st_table_ref
uchar *key_buff; ///< value to look for with key
uchar *key_buff2; ///< key_buff+key_length
store_key **key_copy; //
/*
Bitmap of key parts which refer to constants. key_copy only has copiers for
non-const key parts.
*/
key_part_map const_ref_part_map;
Item **items; ///< val()'s for each keypart
/*
Array of pointers to trigger variables. Some/all of the pointers may be
@ -897,7 +904,6 @@ protected:
public:
JOIN_TAB *join_tab, **best_ref;
/*
For "Using temporary+Using filesort" queries, JOIN::join_tab can point to
either:
@ -909,6 +915,15 @@ public:
*/
JOIN_TAB *table_access_tabs;
uint top_table_access_tabs_count;
/*
Saved join_tab for pre_sorting. create_sort_index() will save here..
*/
JOIN_TAB *pre_sort_join_tab;
uint pre_sort_index;
Item *pre_sort_idx_pushed_cond;
void clean_pre_sort_join_tab();
JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs
JOIN_TAB *join_tab_save; ///< saved join_tab for subquery reexecution
@ -1175,8 +1190,14 @@ public:
const char *zero_result_cause; ///< not 0 if exec must return zero result
bool union_part; ///< this subselect is part of union
enum join_optimization_state { NOT_OPTIMIZED=0,
OPTIMIZATION_IN_PROGRESS=1,
OPTIMIZATION_DONE=2};
bool optimized; ///< flag to avoid double optimization in EXPLAIN
bool initialized; ///< flag to avoid double init_execution calls
enum { QEP_NOT_PRESENT_YET, QEP_AVAILABLE, QEP_DELETED} have_query_plan;
/*
Additional WHERE and HAVING predicates to be considered for IN=>EXISTS
@ -1259,6 +1280,7 @@ public:
ref_pointer_array_size= 0;
zero_result_cause= 0;
optimized= 0;
have_query_plan= QEP_NOT_PRESENT_YET;
initialized= 0;
cond_equal= 0;
having_equal= 0;
@ -1279,6 +1301,8 @@ public:
outer_ref_cond= pseudo_bits_cond= NULL;
in_to_exists_where= NULL;
in_to_exists_having= NULL;
pre_sort_join_tab= NULL;
}
int prepare(Item ***rref_pointer_array, TABLE_LIST *tables, uint wind_num,
@ -1287,9 +1311,11 @@ public:
SELECT_LEX_UNIT *unit);
bool prepare_stage2();
int optimize();
int optimize_inner();
int reinit();
int init_execution();
void exec();
void exec_inner();
int destroy();
void restore_tmp();
bool alloc_func_list();
@ -1403,6 +1429,11 @@ public:
{
return (unit->item && unit->item->is_in_predicate());
}
int print_explain(select_result_sink *result, uint8 explain_flags,
bool on_the_fly,
bool need_tmp_table, bool need_order,
bool distinct,const char *message);
private:
/**
TRUE if the query contains an aggregate function but has no GROUP
@ -1754,6 +1785,9 @@ inline bool optimizer_flag(THD *thd, uint flag)
return (thd->variables.optimizer_switch & flag);
}
int print_fake_select_lex_join(select_result_sink *result, bool on_the_fly,
SELECT_LEX *select_lex, uint8 select_options);
uint get_index_for_order(ORDER *order, TABLE *table, SQL_SELECT *select,
ha_rows limit, bool *need_sort, bool *reverse);
ORDER *simple_remove_const(ORDER *order, COND *where);