mariadb/storage
Sergei Petrunia 4cff562f3f MDEV-38164: Fix the estimates reported by TABLE::key_storage_length()
They were based on the maximum possible key tuple length, which can be
much larger than the real data size.

The return value is used by handler::keyread_time(), which is used
to estimate the cost of range access.
This could cause range access not to be picked, even if it uses
the clustered PK and reads about 8% of the table.

The fix is to add KEY::stat_storage_length (next to KEY::rec_per_key) and
have the storage engine fill it in handler::info(HA_STATUS_CONST).

Currently, only InnoDB fills this based on its internal statistics:
index->stat_index_size and ib_table->stat_n_rows.

Also changed:
- In handler::calculate_costs(), use ha_keyread_clustered_time() when
  computing clustered PK read cost, not ha_keyread_time().

The fix is OFF by default and enabled by setting FIX_INDEX_LOOKUP_COST flag
in @@new_mode.
2025-12-02 10:54:31 +02:00
..
archive Merge 10.6 into 10.11 2024-06-27 10:26:09 +03:00
blackhole Merge 10.11 into 11.4 2024-12-02 11:35:34 +02:00
columnstore columnstore 25.10.1-1 2025-10-24 13:32:45 +02:00
connect cleanup: CREATE_TYPELIB_FOR() helper 2025-10-25 00:19:11 +07:00
csv Merge 10.11 into 11.4 2025-09-03 10:32:56 +03:00
example cleanup: CREATE_TYPELIB_FOR() helper 2025-10-25 00:19:11 +07:00
federated Merge 10.11 into 11.4 2024-12-02 11:35:34 +02:00
federatedx MDEV-37484: Sql_cmd_dml::execute_inner, Sql_cmd_update::execute_inner do not call Select handler for the engine involved 2025-11-27 13:13:17 +05:30
heap Fixed costs in JOIN_TAB::estimate_scan_time() and HEAP 2025-02-10 15:59:28 +02:00
innobase MDEV-38164: Fix the estimates reported by TABLE::key_storage_length() 2025-12-02 10:54:31 +02:00
maria Merge 10.11 into 11.4 2025-11-28 12:56:27 +02:00
mroonga cleanup: CREATE_TYPELIB_FOR() helper 2025-10-25 00:19:11 +07:00
myisam cleanup: CREATE_TYPELIB_FOR() helper 2025-10-25 00:19:11 +07:00
myisammrg cleanup: CREATE_TYPELIB_FOR() helper 2025-10-25 00:19:11 +07:00
oqgraph Merge 10.11 into 11.4 2024-12-02 11:35:34 +02:00
perfschema Merge 10.11 into 11.4 2025-09-03 10:32:56 +03:00
rocksdb cleanup: CREATE_TYPELIB_FOR() helper 2025-10-25 00:19:11 +07:00
sequence Merge branch '10.11' into 11.1 2024-07-08 22:40:16 +02:00
sphinx Merge 10.11 into 11.4 2024-12-02 11:35:34 +02:00
spider MDEV-37484: Sql_cmd_dml::execute_inner, Sql_cmd_update::execute_inner do not call Select handler for the engine involved 2025-11-27 13:13:17 +05:30
test_sql_discovery Merge 10.5 into 10.6 2024-06-24 13:09:47 +03:00