統計情報をアンロック
UNLOCK STATS 、テーブルまたはテーブルの統計のロックを解除するために使用されます。
概要
- UnlockStatsStmt
- TableNameList
- TableName
- PartitionNameList
UnlockStatsStmt ::=
    'UNLOCK' 'STATS' (TableNameList | TableName 'PARTITION' PartitionNameList)
TableNameList ::=
    TableName (',' TableName)*
TableName ::=
    Identifier ( '.' Identifier )?
PartitionNameList ::=
    Identifier ( ',' Identifier )*
例
ロック統計の例を参照してテーブルtを作成し、その統計をロックします。
表tの統計をロック解除すると、 ANALYZE正常に実行できます。
mysql> UNLOCK STATS t;
Query OK, 0 rows affected (0.01 sec)
mysql> ANALYZE TABLE t;
Query OK, 0 rows affected, 1 warning (0.03 sec)
mysql> SHOW WARNINGS;
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                                                                                 |
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Note  | 1105 | Analyze use auto adjusted sample rate 1.000000 for table test.t, reason to use this rate is "use min(1, 110000/8) as the sample-rate=1" |
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
ロック統計の例を参照してテーブルtを作成し、そのパーティションp1の統計をロックします。
パーティションp1の統計をロック解除すると、 ANALYZE正常に実行できます。
mysql> UNLOCK STATS t PARTITION p1;
Query OK, 0 rows affected (0.00 sec)
mysql> ANALYZE TABLE t PARTITION p1;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> SHOW WARNINGS;
+-------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                                                                                                              |
+-------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Note  | 1105 | Analyze use auto adjusted sample rate 1.000000 for table test.t's partition p1, reason to use this rate is "TiDB assumes that the table is empty, use sample-rate=1" |
+-------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
MySQLの互換性
このステートメントは、MySQL 構文に対する TiDB 拡張です。