mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 23:25:34 +02:00
Merge 10.2 into 10.3
This commit is contained in:
commit
2b6f804490
24 changed files with 293 additions and 283 deletions
|
|
@ -6558,21 +6558,19 @@ btr_record_not_null_field_in_rec(
|
|||
}
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Estimates the number of different key values in a given index, for
|
||||
/** 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
|
||||
index->stat_n_sample_sizes[].
|
||||
result.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 */
|
||||
array result.n_non_null_key_vals.
|
||||
@param[in] index index
|
||||
@return vector with statistics information
|
||||
empty vector if the index is unavailable. */
|
||||
std::vector<index_field_stats_t>
|
||||
btr_estimate_number_of_different_key_vals(dict_index_t* index)
|
||||
{
|
||||
btr_cur_t cursor;
|
||||
page_t* page;
|
||||
|
|
@ -6592,11 +6590,11 @@ btr_estimate_number_of_different_key_vals(
|
|||
rec_offs* offsets_rec = NULL;
|
||||
rec_offs* offsets_next_rec = NULL;
|
||||
|
||||
std::vector<index_field_stats_t> result;
|
||||
|
||||
/* For spatial index, there is no such stats can be
|
||||
fetched. */
|
||||
if (dict_index_is_spatial(index)) {
|
||||
return(false);
|
||||
}
|
||||
ut_ad(!dict_index_is_spatial(index));
|
||||
|
||||
n_cols = dict_index_get_n_unique(index);
|
||||
|
||||
|
|
@ -6705,7 +6703,7 @@ btr_estimate_number_of_different_key_vals(
|
|||
mtr_commit(&mtr);
|
||||
mem_heap_free(heap);
|
||||
|
||||
return(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Count the number of different key values for each prefix of
|
||||
|
|
@ -6811,8 +6809,12 @@ exit_loop:
|
|||
also the pages used for external storage of fields (those pages are
|
||||
included in index->stat_n_leaf_pages) */
|
||||
|
||||
result.reserve(n_cols);
|
||||
|
||||
for (j = 0; j < n_cols; j++) {
|
||||
index->stat_n_diff_key_vals[j]
|
||||
index_field_stats_t stat;
|
||||
|
||||
stat.n_diff_key_vals
|
||||
= BTR_TABLE_STATS_FROM_SAMPLE(
|
||||
n_diff[j], index, n_sample_pages,
|
||||
total_external_size, not_empty_flag);
|
||||
|
|
@ -6833,25 +6835,23 @@ exit_loop:
|
|||
add_on = n_sample_pages;
|
||||
}
|
||||
|
||||
index->stat_n_diff_key_vals[j] += add_on;
|
||||
stat.n_diff_key_vals += add_on;
|
||||
|
||||
index->stat_n_sample_sizes[j] = n_sample_pages;
|
||||
stat.n_sample_sizes = n_sample_pages;
|
||||
|
||||
/* Update the stat_n_non_null_key_vals[] with our
|
||||
sampled result. stat_n_non_null_key_vals[] is created
|
||||
and initialized to zero in dict_index_add_to_cache(),
|
||||
along with stat_n_diff_key_vals[] array */
|
||||
if (n_not_null != NULL) {
|
||||
index->stat_n_non_null_key_vals[j] =
|
||||
stat.n_non_null_key_vals =
|
||||
BTR_TABLE_STATS_FROM_SAMPLE(
|
||||
n_not_null[j], index, n_sample_pages,
|
||||
total_external_size, not_empty_flag);
|
||||
}
|
||||
|
||||
result.push_back(stat);
|
||||
}
|
||||
|
||||
mem_heap_free(heap);
|
||||
|
||||
return(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*================== EXTERNAL STORAGE OF BIG FIELDS ===================*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue