mariadb/storage
Thirunarayanan Balathandayuthapani a157161d54 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. Added the new stat name like n_nonnull_fld01, n_nonull_fld02 etc
with stats description to indicate how many non-nulls value exist
for nth field of the index. This value is properly retrieved and
stored in index statistics in dict_stats_fetch_index_stats_step().

8. 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.
2026-02-10 16:01:18 +05:30
..
archive Merge 10.6 into 10.11 2024-06-27 10:26:09 +03:00
blackhole MDEV-34348: my_hash_get_key fixes 2024-11-23 08:14:22 -07:00
columnstore Merge branch '10.6' into 10.11 2025-10-22 09:44:15 +02:00
connect MDEV-37633 Connect UDF functions push empty string warning. 2025-09-12 16:29:04 +10:00
csv Merge 10.6 into 10.11 2025-08-22 06:47:54 +03:00
example MDEV-36729: ha_example::show_func_example is incorrectly defined 2025-05-29 10:10:52 +10:00
federated Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
federatedx MDEV-29874: FederatedX error 10000 on multi-table UPDATE/DELETE 2025-10-22 15:35:54 +07:00
heap Merge 10.5 into 10.6 2025-01-20 09:57:37 +02:00
innobase MDEV-19574: innodb_stats_method ignored with persistent statistics 2026-02-10 16:01:18 +05:30
maria MDEV-38246 aria_read index failed on encrypted database during backup 2026-01-31 11:41:23 +01:00
mroonga Fix compiler warnings 2025-09-30 12:06:31 +03:00
myisam Merge branch '10.6' into 10.11 2025-09-12 13:08:40 +02:00
myisammrg Merge 10.6 into 10.11 2025-01-08 12:51:26 +02:00
oqgraph Merge 10.6 into 10.11 2024-11-29 13:43:17 +02:00
perfschema Merge 10.6 into 10.11 2025-08-22 06:47:54 +03:00
rocksdb MDEV-38110 Sever shutdown prevented by RocksDB setting rocksdb_pause_background_work 2026-01-14 19:44:54 +01:00
sequence MDEV-33746 Supply missing override markings 2024-06-20 11:32:13 -04:00
sphinx Merge 10.5 into 10.6 2024-11-29 12:37:46 +02:00
spider MDEV-38540 - spider/bugfix.perfschema fails sporadically 2026-01-12 23:00:13 +04:00
test_sql_discovery Merge 10.5 into 10.6 2024-06-24 13:09:47 +03:00