Syntax\n------\n\nCHECK TABLE tbl_name [, tbl_name] ... [option] ...\n\noption = {FOR UPGRADE | QUICK | FAST | MEDIUM | EXTENDED | CHANGED}\n\nDescription\n-----------\n\nCHECK TABLE checks a table or tables for errors. CHECK TABLE works for Archive, Aria, CSV, InnoDB, MyISAM, and, from MariaDB 12.0, Sequence tables. For Aria and MyISAM tables, the key statistics are updated as well. For CSV, see also Checking and Repairing CSV Tables.\n\nAs an alternative, myisamchk is a command-line tool for checking MyISAM tables when the tables are not being accessed. For Aria tables, there is a similar tool: aria_chk.\n\nFor checking dynamic columns' integrity, COLUMN_CHECK() can be used.\n\nCHECK TABLE can also check views for problems, such as tables that are referenced in the view definition that no longer exist.\n\nCHECK TABLE is also supported for partitioned tables. You can use ALTER TABLE ... CHECK PARTITION to check one or more partitions.\n\nThe meaning of the different options is as follows - note that this can vary a bit between storage engines:\n\n| Option      | Explanation                                                                                                                                                                                                                                                                        |\n| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| FOR UPGRADE | Do a very quick check if the storage format for the table has changed so that one needs to do a REPAIR. This is only needed when one upgrades between major versions of MariaDB or MySQL. This is usually done by running mariadb-upgrade. |\n| FAST        | Only check tables that has not been closed properly or are marked as corrupt. Only supported by the MyISAM and Aria engines. For other engines the table is checked normally                                                                                                       |\n| CHANGED     | Check only tables that have changed since the last REPAIR / CHECK. Only supported by the MyISAM and Aria engines. For other engines, the table is checked normally.                                                                                                            |\n| QUICK       | Do a fast check. For MyISAM and Aria, this means skipping the check of the delete link chain, which may take some time.                                                                                                                                                            |\n| MEDIUM      | Scan also the data files. Checks the integrity between data and index files with checksums. In most cases, this should find all possible errors.                                                                                                                                   |\n| EXTENDED    | Does a full check to verify every possible error. For InnoDB, Aria, and MyISAM, verify for each row that all its keys exist, and for those index keys, they point back to the primary clustered key. This may take a long time on large tables.                                    |\n\nThe EXTENDED option is available to InnoDB, too.\n\nThe EXTENDED option is ignored by InnoDB.\n\nWhen the EXTENDED option is given, MariaDB also checks for referential integrity.\n\nMariaDB does not check for referential integrity, even if the EXTENDED option is given.\n\nFor most cases, running CHECK TABLE without options or MEDIUM should be good enough.\n\nThe Aria storage engine supports progress reporting for this statement.\n\nIf you want to know if two tables are identical, take a look at CHECKSUM TABLE.\n\nInnoDB\n\nIf CHECK TABLE finds an error in an InnoDB table, MariaDB might shut down to prevent the error propagation. In this case, the problem will be reported in the error log. Otherwise, the table or an index might be marked as corrupted, to prevent use. This does not happen with some minor problems, like a wrong number of entries in a secondary index. Those problems are reported in the output of CHECK TABLE.\n\nEach tablespace contains a header with metadata. This header is not checked by this statement.\n\nDuring the execution of CHECK TABLE, other threads may be blocked.\n\nExamples\n--------\n\nCHECK TABLE y EXTENDED;\n+--------+-------+----------+----------+\n| Table  | Op    | Msg_type | Msg_text |\n+--------+-------+----------+----------+\n| test.y | check | status   | OK       |\n+--------+-------+----------+----------+\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/table-statements/check-table