[MDEV-4400] wrong numbers for SHOW INDEX and SHOW TABLE STATUS with EITS Created: 2013-04-16  Updated: 2022-09-08

Status: Confirmed
Project: MariaDB Server
Component/s: Admin statements, Optimizer
Affects Version/s: 10.0.2, 10.0, 10.1
Fix Version/s: 10.1

Type: Bug Priority: Minor
Reporter: Axel Schwenke Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: eits
Environment:

observed in the 10.0-mdev83 tree used for DBT3


Attachments: File eits.sql    

 Description   

With EITS (use_stat_tables='preferably') and correct stats in mysql.table/index_stats the following statements return the InnoDB internal estimates instead of the exact numbers:

  • SHOW TABLE STATUS
  • SHOW INDEX FROM ...

Example results for a table with 8000 rows:

+----------+
| count(*) |
+----------+
|     8000 |
+----------+
+---------+---------+----------+----------+
| Table   | Op      | Msg_type | Msg_text |
+---------+---------+----------+----------+
| test.t1 | analyze | status   | OK       |
+---------+---------+----------+----------+
+---------+------------+-------------+
| db_name | table_name | cardinality |
+---------+------------+-------------+
| test    | t1         |        8000 |
+---------+------------+-------------+
+---------+------------+------------+--------------+---------------+
| db_name | table_name | index_name | prefix_arity | avg_frequency |
+---------+------------+------------+--------------+---------------+
| test    | t1         | PRIMARY    |            1 |        1.0000 |
| test    | t1         | c1         |            1 |        1.0000 |
| test    | t1         | c2         |            1 |       81.6327 |
+---------+------------+------------+--------------+---------------+
+----------------+
| c2 cardinality |
+----------------+
|        97.9999 |
+----------------+
+-------+----------+--------------+-------------+-------------+
| Table | Key_name | Seq_in_index | Column_name | Cardinality |
+-------+----------+--------------+-------------+-------------+
| t1    | PRIMARY  |            1 | c1          |        8050 |
| t1    | c1       |            1 | c1          |        8050 |
| t1    | c2       |            1 | c2          |         187 |
+-------+----------+--------------+-------------+-------------+
+------+--------+---------+------------+------+
| Name | Engine | Version | Row_format | Rows |
+------+--------+---------+------------+------+
| t1   | InnoDB |      10 | Compact    | 8050 |
+------+--------+---------+------------+------+


Generated at Thu Feb 08 06:56:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.