diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-29 13:38:38 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-29 13:38:38 +0200 |
commit | 7b2bb67113bdda470955e3d4d72be0f2c0b38902 (patch) | |
tree | 9f9f34da1a4e48c243c56ff161987074ef907cbb /storage/innobase/include/btr0cur.h | |
parent | 27b762e23d8305bbc65dc61d283fe192e2dbd00a (diff) | |
parent | 1e778a3b5624f97fdf44a15fd6cee3d615891cff (diff) | |
download | mariadb-git-7b2bb67113bdda470955e3d4d72be0f2c0b38902.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase/include/btr0cur.h')
-rw-r--r-- | storage/innobase/include/btr0cur.h | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 12aaa73ae30..1f1ac2a09e7 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -614,8 +614,24 @@ btr_estimate_n_rows_in_range( const dtuple_t* tuple2, page_cur_mode_t mode2); -/*******************************************************************//** -Estimates the number of different key values in a given index, for + +/** Statistics for one field of an index. */ +struct index_field_stats_t +{ + ib_uint64_t n_diff_key_vals; + ib_uint64_t n_sample_sizes; + ib_uint64_t n_non_null_key_vals; + + index_field_stats_t(ib_uint64_t n_diff_key_vals= 0, + ib_uint64_t n_sample_sizes= 0, + ib_uint64_t n_non_null_key_vals= 0) + : n_diff_key_vals(n_diff_key_vals), n_sample_sizes(n_sample_sizes), + n_non_null_key_vals(n_non_null_key_vals) + { + } +}; + +/** Estimates the number of different key values in a given index, for each n-column prefix of the index where 1 <= n <= dict_index_get_n_unique(index). The estimates are stored in the array index->stat_n_diff_key_vals[] (indexed 0..n_uniq-1) and the number of pages that were sampled is saved in @@ -623,12 +639,11 @@ index->stat_n_sample_sizes[]. If innodb_stats_method is nulls_ignored, we also record the number of non-null values for each prefix and stored the estimates in array index->stat_n_non_null_key_vals. -@return true if the index is available and we get the estimated numbers, -false if the index is unavailable. */ -bool -btr_estimate_number_of_different_key_vals( -/*======================================*/ - dict_index_t* index); /*!< in: index */ +@param[in] index index +@return stat vector if the index is available and we get the estimated numbers, +empty vector if the index is unavailable. */ +std::vector<index_field_stats_t> +btr_estimate_number_of_different_key_vals(dict_index_t* index); /** Gets the externally stored size of a record, in units of a database page. @param[in] rec record |