mariadb/storage/innobase/btr
Thirunarayanan Balathandayuthapani 57cab3e3a2 MDEV-19574: innodb_stats_method ignored with persistent statistics
Problem:
========
When persistent statistics are enabled (innodb_stats_persistent=ON),
the innodb_stats_method setting was not being properly passed
through the statistics calculation chain. This caused NULL handling
to always use the default behavior, regardless of the
configured stats method.

The issue affected query optimization for queries involving
NULL values, as the statistics collection wasn't respecting
the user's preference for NULL value treatment
(NULLS_EQUAL, NULLS_UNEQUAL, or NULLS_IGNORED).

Solution:
========
1. Passed innodb_stats_method parameter through the
statistics calculation chain:
 - dict_stats_scan_page()
 - dict_stats_analyze_index_below_cur()
 - dict_stats_analyze_index_for_n_prefix()
 - dict_stats_analyze_index_level
 - dict_stats_analyze_index
 - dict_stats_update_persistent
 - dict_stats_save

2. Conditionally set n_non_null_key_vals based on the NULLS_IGNORED
method.

3. Introduced IndexLevelStats which is to collect statistics
at a specific B-tree level during index analysis

4. Introduced LeafPageStats which is to collect statistics
for leaf page analysis

5. IndexLevelStats, LeafPageStats replaces multiple individual
parameters in function signatures.

6. Add stats method name to stat_description in case of non
default innodb_stats_method variable value

7. When InnoDB scan the leaf page directly, assign leaf page
count as number of pages scanned in case of multi-level index.
For single page indexes, use 1. This change leads to multiple
changes in existing test case.
2025-10-20 23:38:57 +05:30
..
btr0btr.cc Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
btr0bulk.cc Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
btr0cur.cc MDEV-19574: innodb_stats_method ignored with persistent statistics 2025-10-20 23:38:57 +05:30
btr0defragment.cc MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
btr0pcur.cc Merge 10.6 into 10.11 2024-09-06 16:17:42 +03:00
btr0sea.cc MDEV-36759: Huge performance drop 2025-05-13 12:27:50 +03:00