Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.52 KB

sql-statement-flush-tables.md

File metadata and controls

59 lines (42 loc) · 1.52 KB
title summary aliases
FLUSH TABLES | TiDB SQL Statement Reference
An overview of the usage of FLUSH TABLES for the TiDB database.
/docs/dev/sql-statements/sql-statement-flush-tables/
/docs/dev/reference/sql/statements/flush-tables/

FLUSH TABLES

This statement is included for compatibility with MySQL. It has no effective usage in TiDB.

Synopsis

FlushStmt ::=
    'FLUSH' NoWriteToBinLogAliasOpt FlushOption

NoWriteToBinLogAliasOpt ::=
    ( 'NO_WRITE_TO_BINLOG' | 'LOCAL' )?

FlushOption ::=
    'PRIVILEGES'
|   'STATUS'
|    'TIDB' 'PLUGINS' PluginNameList
|    'HOSTS'
|    LogTypeOpt 'LOGS'
|    TableOrTables TableNameListOpt WithReadLockOpt

LogTypeOpt ::=
    ( 'BINARY' | 'ENGINE' | 'ERROR' | 'GENERAL' | 'SLOW' )?

TableOrTables ::=
    'TABLE'
|   'TABLES'

TableNameListOpt ::=
    TableNameList?

WithReadLockOpt ::=
    ( 'WITH' 'READ' 'LOCK' )?

Examples

mysql> FLUSH TABLES;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH TABLES WITH READ LOCK;
ERROR 1105 (HY000): FLUSH TABLES WITH READ LOCK is not supported.  Please use @@tidb_snapshot

MySQL compatibility

  • TiDB does not have a concept of table cache as in MySQL. Thus, FLUSH TABLES is parsed but ignored in TiDB for compatibility.
  • The statement FLUSH TABLES WITH READ LOCK produces an error, as TiDB does not currently support locking tables. It is recommended to use Historical reads for this purpose instead.

See also