-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
MDEV-19574 innodb_stats_method is not honored when innodb_stats_persistent=ON #4204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 10.11
Are you sure you want to change the base?
Conversation
|
msan failure is MDEV-28165 |
a1aa0d8
to
ab6c670
Compare
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, | ||
f3 INT, KEY(f1, f3), key(f3)) STATS_PERSISTENT=1,ENGINE=INNODB; | ||
INSERT INTO t1 SELECT seq, seq, NULL from seq_1_to_16384; | ||
ANALYZE TABLE t1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we cover this for the maximum number of index columns, similar to how 464055f extended the test innodb.purge
? I think that the maximum would be with a 32-column PRIMARY KEY
and a 32-column non-unique secondary index.
dict_stats_analyze_index_for_n_prefix( | ||
dict_index_t* index, | ||
ulint n_prefix, | ||
bool nulls_unequal, | ||
bool calc_non_null, | ||
const boundaries_t* boundaries, | ||
n_diff_data_t* n_diff_data, | ||
mtr_t* mtr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we pass fewer parameters here? Could IndexScanStatistics
or something similar be used here as well?
static | ||
void | ||
dict_stats_analyze_index_below_cur( | ||
const btr_cur_t* cur, | ||
ulint n_prefix, | ||
bool nulls_unequal, | ||
ib_uint64_t* n_diff, | ||
ib_uint64_t* n_external_pages) | ||
ib_uint64_t* n_external_pages, | ||
ib_uint64_t* n_non_null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we pass fewer parameters here? Can IndexScanStatistics
or something similar be used here?
…stent=ON Problem: ======= InnoDB persistent statistics doesn't take innodb_stats_method variable while calculating n_diff_pfx for the n-prefix index columns. Solution: ========= While calculating the persistent statistics, InnoDB consider all NULLS as different value when innodb_stats_method is set to NULLS_UNEQUAL or NULLS_IGNORED. InnoDB statistics depends on the value of "innodb_stats_method" variable when the statistics were last recalculated. dict_stats_analyze_index_level(), dict_stats_scan_page(), dict_stats_analyze_index_below_cur(), dict_stats_analyze_index_for_n_prefix(): All function accepts the parameter to indicate the innodb_stats_method. It also calculates the number of non-null key value for each level or leaf page dict_stats_index_set_n_diff(): calculates the number of non-null values similar to number of different key values. Append the non-default innodb_stats_method variable name for n_diff_pfx statistics description in mysql.innodb_index_stats. IndexScanStatistics: Structure to store the various statistical metric gathered during index scan fetch operation. This structure is being used in dict_stats_analyze_index_level() to fetch the statistics
ab6c670
to
a7a9339
Compare
Description
Problem:
InnoDB persistent statistics doesn't take innodb_stats_method
variable while calculating n_diff_pfx for the n-prefix index columns.
Solution:
While calculating the persistent statistics, InnoDB consider all NULLS as different value when innodb_stats_method is set to NULLS_UNEQUAL or NULLS_IGNORED. InnoDB statistics depends on the value of "innodb_stats_method" variable when the statistics were last recalculated.
dict_stats_analyze_index_level(),
dict_stats_scan_page(),
dict_stats_analyze_index_below_cur(),
dict_stats_analyze_index_for_n_prefix(): All function accepts the parameter to indicate the innodb_stats_method. It also calculates the number of non-null key value for each level or leaf page
dict_stats_index_set_n_diff(): calculates the number of non-null values similar to number of different key values.
Append the innodb_stats_method variable name for n_diff_pfx statistics description in mysql.innodb_index_stats.
Release Notes
InnoDB persisent statistics is stored in mysql.innodb_index_stats based on innodb_stats_method variable
How can this PR be tested?
./mtr innodb.innodb_stats_method
Basing the PR against the correct MariaDB version
main
branch.PR quality check