[MDEV-22851] Engine independent index statistics are incorrect for large tables on Windows Created: 2020-06-10 Updated: 2020-07-21 Resolved: 2020-07-15 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.4.13, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.1.46, 10.2.33, 10.3.24, 10.4.14, 10.5.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Lars Hansen | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 10 |
||
| Description |
|
On Windows systems, the engine independend index statistics are incorrect for large tables. 1. install a new MariaDB 10.4.13 server on Windows. 2. connect to the server and use the "test" schema. 3. switch on engine independent statistics.
4. create a table with about 60000 rows.
5. create index on TABLE_CATALOG.
6.
Since the TABLE_CATALOG column always contains the same value, the expectation is that avg_frequency equals rowcount (about 60000).
7.
However, the table mysql.index_stats shows only about 16000 as avg_frequency for the TABLE_CATALOG column. On Linux, the values are as expected. |
| Comments |
| Comment by Elena Stepanova [ 2020-07-08 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Thanks for the report. Reproducible as described.
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2020-07-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Varun, please investigate | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2020-07-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
The issue here: The average frequency is defined as The average frequency for the index (AAA) on table t1: So average_frequency : 59552
The Scale_factor_avg_frequency is defined as 100000. So the multiplication would lead to an overflow as ulong is defined as 4 bytes on windows. The solution is to switch avg_frequency to ulonglong so that 8 bytes is used and we don't overflow. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2020-07-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
http://lists.askmonty.org/pipermail/commits/2020-July/014284.html | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2020-07-14 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Ok to push. |