diff options
Diffstat (limited to 'sql/sql_join_cache.h')
-rw-r--r-- | sql/sql_join_cache.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h index 10a8c5fd831..f6c0ebdbaf3 100644 --- a/sql/sql_join_cache.h +++ b/sql/sql_join_cache.h @@ -63,12 +63,14 @@ typedef struct st_cache_field { class JOIN_TAB_SCAN; +struct st_explain_bka_type; /* JOIN_CACHE is the base class to support the implementations of - Block Nested Loop (BNL) Join Algorithm, - Block Nested Loop Hash (BNLH) Join Algorithm, - Batched Key Access (BKA) Join Algorithm. + The first algorithm is supported by the derived class JOIN_CACHE_BNL, the second algorithm is supported by the derived class JOIN_CACHE_BNLH, while the third algorithm is implemented in two variant supported by @@ -97,6 +99,9 @@ private: /* Size of the offset of a field within a record in the cache */ uint size_of_fld_ofs; + /* This structure is used only for explain, not for execution */ + bool for_explain_only; + protected: /* 3 functions below actually do not use the hidden parameter 'this' */ @@ -420,7 +425,7 @@ protected: /* Shall calculate how much space is remaining in the join buffer */ virtual size_t rem_space() { - return max(buff_size-(end_pos-buff)-aux_buff_size,0); + return MY_MAX(buff_size-(end_pos-buff)-aux_buff_size,0); } /* @@ -593,7 +598,7 @@ public: JOIN_CACHE *next_cache; /* Shall initialize the join cache structure */ - virtual int init(); + virtual int init(bool for_explain); /* Get the current size of the cache join buffer */ size_t get_join_buffer_size() { return buff_size; } @@ -657,7 +662,7 @@ public: enum_nested_loop_state join_records(bool skip_last); /* Add a comment on the join algorithm employed by the join cache */ - virtual void print_explain_comment(String *str); + virtual void save_explain_data(struct st_explain_bka_type *explain); THD *thd(); @@ -943,7 +948,7 @@ protected: */ size_t rem_space() { - return max(last_key_entry-end_pos-aux_buff_size,0); + return MY_MAX(last_key_entry-end_pos-aux_buff_size,0); } /* @@ -989,7 +994,7 @@ protected: public: /* Initialize a hashed join cache */ - int init(); + int init(bool for_explain); /* Reset the buffer of a hashed join cache for reading/writing */ void reset(bool for_writing); @@ -1125,7 +1130,7 @@ public: :JOIN_CACHE(j, tab, prev) {} /* Initialize the BNL cache */ - int init(); + int init(bool for_explain); enum Join_algorithm get_join_alg() { return BNL_JOIN_ALG; } @@ -1192,7 +1197,7 @@ public: : JOIN_CACHE_HASHED(j, tab, prev) {} /* Initialize the BNLH cache */ - int init(); + int init(bool for_explain); enum Join_algorithm get_join_alg() { return BNLH_JOIN_ALG; } @@ -1323,7 +1328,7 @@ public: uchar **get_curr_association_ptr() { return &curr_association; } /* Initialize the BKA cache */ - int init(); + int init(bool for_explain); enum Join_algorithm get_join_alg() { return BKA_JOIN_ALG; } @@ -1335,7 +1340,7 @@ public: /* Check index condition of the joined table for a record from BKA cache */ bool skip_index_tuple(range_id_t range_info); - void print_explain_comment(String *str); + void save_explain_data(struct st_explain_bka_type *explain); }; @@ -1419,12 +1424,12 @@ public: uchar **get_curr_association_ptr() { return &curr_matching_chain; } /* Initialize the BKAH cache */ - int init(); + int init(bool for_explain); enum Join_algorithm get_join_alg() { return BKAH_JOIN_ALG; } /* Check index condition of the joined table for a record from BKAH cache */ bool skip_index_tuple(range_id_t range_info); - void print_explain_comment(String *str); + void save_explain_data(struct st_explain_bka_type *explain); }; |