-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SHOW cmd LIKE 'expr' filters on DBName not TableName #9373
Comments
It's a little strange that i cannot reproduce this bug with the same TiDB version. |
But my environment existed... I also feel very strange. Can you see here ? |
@wentaojin |
show stats_meta where table_name like '%' ,this command can output results, as follow: mysql> show stats_meta where table_name like '%'; mysql> show stats_meta where table_name like '%tidb'; |
@wentaojin |
No,it also can not output result,but I found a strange phenomenon that the result of mysql> show stats_meta; mysql> show stats_meta like '%f%'; mysql> show stats_meta like '%b%'; mysql> show stats_meta where table_name like '%b%'; mysql> show stats_meta where table_name like '%f%'; |
@wentaojin I want to provide you a TiDB binary with more log information to help us understand why this happened. Is this ok for you? |
So... Directly use |
I can confirm in master that the matching is on DBName, which doesn't really make sense, because it also applies filtering on the currently selected DBName. Here is a testcase: DROP TABLE IF EXISTS ta1;
CREATE TABLE ta1 (id INT NOT NULL PRIMARY KEY auto_increment);
INSERT INTO ta1 VALUES (1);
ANALYZE TABLE ta1;
SELECT SLEEP(1);
SHOW STATS_META;
SHOW STATS_META LIKE 'ta1';
SHOW STATS_META LIKE 't%';
SHOW STATS_META LIKE 'ta%';
SHOW STATS_META LIKE 'te%';
..
mysql> SHOW STATS_META;
+---------+------------+----------------+---------------------+--------------+-----------+
| Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count |
+---------+------------+----------------+---------------------+--------------+-----------+
| test | ta1 | | 2020-07-14 15:56:28 | 0 | 1 |
+---------+------------+----------------+---------------------+--------------+-----------+
1 row in set (0.00 sec)
mysql> SHOW STATS_META LIKE 'ta1';
Empty set (0.00 sec)
mysql> SHOW STATS_META LIKE 't%';
+---------+------------+----------------+---------------------+--------------+-----------+
| Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count |
+---------+------------+----------------+---------------------+--------------+-----------+
| test | ta1 | | 2020-07-14 15:56:28 | 0 | 1 |
+---------+------------+----------------+---------------------+--------------+-----------+
1 row in set (0.00 sec)
mysql> SHOW STATS_META LIKE 'ta%';
Empty set (0.00 sec)
mysql> SHOW STATS_META LIKE 'te%';
+---------+------------+----------------+---------------------+--------------+-----------+
| Db_name | Table_name | Partition_name | Update_time | Modify_count | Row_count |
+---------+------------+----------------+---------------------+--------------+-----------+
| test | ta1 | | 2020-07-14 15:56:28 | 0 | 1 |
+---------+------------+----------------+---------------------+--------------+-----------+
1 row in set (0.00 sec)
mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-762-g77aecd4b2
Edition: Community
Git Commit Hash: 77aecd4b27e79a97215eb4fdd68f68f2ddf67d21
Git Branch: master
UTC Build Time: 2020-07-13 01:43:31
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec) |
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
TiDB cluster Show statistics can be perform fuzzy matching and equivalent query, The documentation is written for support, with a current documentation syntax description:
SHOW STATS_META[ShowLikeOrWhere]
SHOW STATS_BUCKETS [ShowLikeOrWhere]
SHOW STATS_STATISTICS [ShowLikeOrWhere]
After manual execute Analyze Table ,Unable to perform fuzzy matching, only equivalent query,As shown
expect to see the result of fuzzy matching
tidb-server -V
or runselect tidb_version();
on TiDB)?mysql> select tidb_version();
| Release Version: v2.1.4
Git Commit Hash: a1d10c1
Git Branch: release-2.1
UTC Build Time: 2019-02-15 06:24:33
GoVersion: go version go1.11.2 linux/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
The text was updated successfully, but these errors were encountered: