MySQL 8.4.2
Source Code Documentation
|
Go to the source code of this file.
Typedefs | |
typedef float | rec_per_key_t |
Functions | |
rec_per_key_t | guess_rec_per_key (const TABLE *const table, const KEY *const key, uint used_keyparts) |
Guesstimate for "records per key" when index statistics is not available. More... | |
typedef float rec_per_key_t |
rec_per_key_t guess_rec_per_key | ( | const TABLE *const | table, |
const KEY *const | key, | ||
uint | used_keyparts | ||
) |
Guesstimate for "records per key" when index statistics is not available.
table | the table |
key | the index |
used_keyparts | the number of key part that should be included in the estimate |
Guesstimate for "records per key" when index statistics is not available.
Assume that the first key part matches 1% of the file and that the whole key matches 10 (duplicates) or 1 (unique) records. For small tables, ensure there are at least ten different key values. Assume also that more key matches proportionally more records. This gives the formula:
records = a - (x-1)/(c-1)*(a-b)
where
b = records matched by whole key a = records matched by first key part (1% of all records?) c = number of key parts in key x = used key parts (1 <= x <= c)