-
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
analyze table report error when usingd dynamic partition_prun_mode #34228
Comments
Could you provided the table structures by |
| oracle_cb_metric_dbtime | CREATE TABLE |
I tested it with tidb v5.2.3 by following sqls, and I can't reproduced the error: mysql> CREATE TABLE oracle_cb_metric_dbtime (
-> id bigint(20) NOT NULL AUTO_INCREMENT,
-> instance_name varchar(12) NOT NULL,
-> end_time datetime NOT NULL,
-> metric_name varchar(64) DEFAULT NULL,
-> value decimal(10,0) DEFAULT NULL,
-> PRIMARY KEY (id,instance_name,end_time) /*T![clustered_index] NONCLUSTERED */,
-> KEY io_idx1 (end_time,instance_name,metric_name),
-> KEY idx1 (id)
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=18037099 /*T! SHARD_ROW_ID_BITS=3 PRE_SPLIT_REGIONS=2 */
-> PARTITION BY RANGE COLUMNS(end_time) (
-> PARTITION p202110 VALUES LESS THAN ("2021-11-01"),
-> PARTITION p202111 VALUES LESS THAN ("2021-12-01"),
-> PARTITION p202112 VALUES LESS THAN ("2022-01-01"),
-> PARTITION p202201 VALUES LESS THAN ("2022-02-01"),
-> PARTITION p202202 VALUES LESS THAN ("2022-03-01"),
-> PARTITION p202203 VALUES LESS THAN ("2022-04-01"),
-> PARTITION p202204 VALUES LESS THAN ("2022-05-01"),
-> PARTITION p202205 VALUES LESS THAN ("2022-06-01"),
-> PARTITION p202206 VALUES LESS THAN ("2022-07-01"),
-> PARTITION p202207 VALUES LESS THAN ("2022-08-01"),
-> PARTITION p202208 VALUES LESS THAN ("2022-09-01"),
-> PARTITION p202209 VALUES LESS THAN ("2022-10-01"),
-> PARTITION p202210 VALUES LESS THAN ("2022-11-01"),
-> PARTITION p202211 VALUES LESS THAN ("2022-12-01"),
-> PARTITION p202212 VALUES LESS THAN ("2023-01-01"),
-> PARTITION pmax VALUES LESS THAN (MAXVALUE)
-> );
Query OK, 0 rows affected (0.14 sec)
mysql> set @@session.tidb_partition_prune_mode = 'dynamic'; Query OK, 0 rows affected (0.00 sec)
mysql> analyze table oracle_cb_metric_dbtime;
Query OK, 0 rows affected (3.99 sec) Could you provide the minimum reproducible steps? @311ybb |
mysql> |
@mjonss Did you meet the errors like this before for dynamic prune mode? |
no ,it's my first time to analyze table under dynamic prune mode? |
@mjonss Please keep an eye on this |
The tidb log may contain the error stack information, and would be helpful for us to know from where the error is throw |
dumpling data |
@311ybb Thanks for your dumping data. After I loaded the data and set the mysql> set @@session.tidb_partition_prune_mode = 'static';
Query OK, 0 rows affected (0.00 sec)
mysql> analyze table oracle_cb_metric_dbtime;
Query OK, 0 rows affected (19.38 sec)
mysql> set @@session.tidb_partition_prune_mode ='dynamic';
Query OK, 0 rows affected (0.00 sec)
mysql> analyze table oracle_cb_metric_dbtime;
ERROR 1105 (HY000): invalid encoded key flag 9 We will focus on it to locate the problem later. |
In v5.0.6 this error is given instead:
|
mysql> select a.table_name,b.stats_ver from information_schema.tables a, mysql.stats_histograms b where a.tidb_table_id=b.table_id and a.table_name='oracle_cb_metric_dbtime'; mysql> show variables like '%analyze_version%'; |
Smaller test case:
|
version:v5.2.3
analyze table report error when usingd dynamic partition_prun_mode
mysql> set @@session.tidb_partition_prune_mode = ‘static’;
Query OK, 0 rows affected (0.00 sec)
mysql> analyze table oracle_cb_metric_dbtime;
Query OK, 0 rows affected (13.97 sec)
mysql> set @@session.tidb_partition_prune_mode = ‘dynamic’;
Query OK, 0 rows affected (0.00 sec)
mysql> analyze table oracle_cb_metric_dbtime;
ERROR 1105 (HY000): invalid encoded key flag 9
mysql> set @@session.tidb_partition_prune_mode = ‘static’;
Query OK, 0 rows affected (0.00 sec)
mysql> analyze table oracle_cb_metric_dbtime;
Query OK, 0 rows affected (14.06 sec)
mysql> set @@session.tidb_partition_prune_mode = ‘dynamic’;
Query OK, 0 rows affected (0.00 sec)
mysql> analyze table oracle_cb_metric_dbtime;
ERROR 1105 (HY000): invalid encoded key flag 9
mysql>
The text was updated successfully, but these errors were encountered: