Skip to content

Improve low cardinality indices detection#195

Merged
macbre merged 6 commits intomasterfrom
low-cardinality-index-fix
Dec 22, 2020
Merged

Improve low cardinality indices detection#195
macbre merged 6 commits intomasterfrom
low-cardinality-index-fix

Conversation

@macbre
Copy link
Owner

@macbre macbre commented Dec 22, 2020

And fix integration tests

Examples

-- Server version:		8.0.20 MySQL Community Server - GPL

mysql> select TABLE_NAME, INDEX_NAME, COLUMN_NAME, CARDINALITY from INFORMATION_SCHEMA.STATISTICS where table_name = '0020_big_table';
+----------------+------------+-------------+-------------+
| TABLE_NAME     | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+----------------+------------+-------------+-------------+
| 0020_big_table | num_idx    | num         |           2 |
| 0020_big_table | PRIMARY    | item_id     |      100256 |
| 0020_big_table | text_idx   | text        |      100256 |
+----------------+------------+-------------+-------------+
3 rows in set (0.00 sec)

vs

-- Server version:		5.5.5-10.5.4-MariaDB-1:10.5.4+maria~focal mariadb.org binary distribution

mysql> select TABLE_NAME, INDEX_NAME, COLUMN_NAME, CARDINALITY from INFORMATION_SCHEMA.STATISTICS where table_name = '0020_big_table';
+----------------+------------+-------------+-------------+
| TABLE_NAME     | INDEX_NAME | COLUMN_NAME | CARDINALITY |
+----------------+------------+-------------+-------------+
| 0020_big_table | PRIMARY    | item_id     |      100256 |
| 0020_big_table | text_idx   | text        |      100256 |
| 0020_big_table | num_idx    | num         |           4 |
+----------------+------------+-------------+-------------+
3 rows in set (0.00 sec)
indexdigest/test/linters/test_0031_low_cardinality_index.py:17: AssertionError
----------------------------- Captured stdout call -----------------------------
get_low_cardinality_indices [{'TABLE_NAME': '0020_big_table', 'INDEX_NAME': 'PRIMARY', 'COLUMN_NAME': 'item_id', 'CARDINALITY': 100000}, {'TABLE_NAME': '0020_big_table', 'INDEX_NAME': 'text_idx', 'COLUMN_NAME': 'text', 'CARDINALITY': 100000}, {'TABLE_NAME': '0020_big_table', 'INDEX_NAME': 'num_idx', 'COLUMN_NAME': 'num', 'CARDINALITY': 6}]

@macbre macbre added this to the v1.4.0 milestone Dec 22, 2020
@macbre macbre force-pushed the low-cardinality-index-fix branch from 852bdf9 to d621a96 Compare December 22, 2020 15:51
@macbre macbre force-pushed the low-cardinality-index-fix branch from 22bb10d to 4fae801 Compare December 22, 2020 19:40
@macbre macbre marked this pull request as ready for review December 22, 2020 19:43
@macbre macbre merged commit d1d90c1 into master Dec 22, 2020
@macbre macbre deleted the low-cardinality-index-fix branch December 22, 2020 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant