diff options
author | Igor Babaev <igor@askmonty.org> | 2012-04-11 17:14:06 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-04-11 17:14:06 -0700 |
commit | 1c0a89afcc1581187e8ee84abbd445da2bfa45d9 (patch) | |
tree | e5c28fa1690c0b42e678005bdf5c3896ee5e99f2 /sql/structs.h | |
parent | ff3d16fba898efa68677f3b0049668a341f27a06 (diff) | |
download | mariadb-git-1c0a89afcc1581187e8ee84abbd445da2bfa45d9.tar.gz |
The pilot implementation of mwl#250: Use the statistics from persistent
statistical tables instead of the statistics provided by engine.
Diffstat (limited to 'sql/structs.h')
-rw-r--r-- | sql/structs.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/structs.h b/sql/structs.h index 51c71db7cd2..9949a72964b 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -96,6 +96,11 @@ typedef struct st_key { uint block_size; uint name_length; enum ha_key_alg algorithm; + /* + The flag is on if statistical data for the index prefixes + has to be taken from the system statistical tables. + */ + bool is_statistics_from_stat_tables; /* Note that parser is used when the table is opened for use, and parser_name is used when the table is being created. @@ -148,6 +153,15 @@ typedef struct st_key { /** reference to the list of options or NULL */ engine_option_value *option_list; ha_index_option_struct *option_struct; /* structure with parsed options */ + + inline double real_rec_per_key(uint i) + { + if (rec_per_key == 0) + return 0; + return (is_statistics_from_stat_tables ? + (ulong) (100 * read_stat.avg_frequency[i]) / (double) 100 : + (double) rec_per_key[i]); + } } KEY; |