Answer Diff [256]
== Syntax:
¶
¶
<<code>> ¶
CHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ] ¶
<</code>> ¶
¶
== Description:
¶
¶
<<fixedcode>>CHECKSUM TABLE<</fixedcode>> reports a table checksum. This is very
¶
useful if you want to know if two tables are the same (for example on a master
¶
and slave). ¶
¶
With <<fixedcode>>QUICK<</fixedcode>>, the live table checksum is reported if it is
¶
available, or
¶
<<fixed>>NULL<</fixed <<code>>NULL<</code>> otherwise. This is very fast. A live
¶
checksum is enabled
¶
by specifying the <<fixedcode>>CHECKSUM=1<</fixedcode>> table
¶
option when you
¶
[[create-table|create the table]]; currently, this is supported
¶
only for Aria and
¶
MyISAM tables.
¶
¶
With <<fixedcode>>EXTENDED<</fixedcode>>, the entire table is read row by row and the
¶
checksum is
¶
calculated. This can be very slow for large tables.
¶
¶
If neither <<fixedcode>>QUICK<</fixed>> nor <<fixedcode>> nor <<code>>EXTENDED<</fixedcode>> is
¶
specified, MariaDB returns a live
¶
checksum if the table storage engine supports
¶
it and scans the table
¶
otherwise.
¶
¶
For a nonexistent table, <<fixedcode>>CHECKSUM TABLE<</fixedcode>> returns <<fixed>>NULL<</fixed
¶
<<code>>NULL<</code>> and generates a
¶
warning.
¶
¶
== Differences between MariaDB and MySQL:
¶
¶
<<fixedcode>>CHECKSUM TABLE<</fixedcode>> may give different result as MariaDB doesn't
¶
ignore <<fixed>>NULL<</fixedcode>>NULL<</code>>'s in the columns as MySQL 5.1 does (Future MySQL
¶
versions should calculate checksums the same way as MariaDB). You can get the
¶
'old style' checksum in MariaDB by starting mysqld with the <<fixed
¶
<<code>>--old<</fixedcode>> option. Note however that that the MyISAM and Aria
¶
storage engines in MariaDB are using the new checksum internally, so if you are
¶
using--old, the <<fixed<<code>>--old<</code>>, the <<code>>CHECKSUM<</fixedcode>> command will be
¶
slower as it needs to calculate the checksum row by row.
¶
¶
¶
<<code>> ¶
CHECKSUM TABLE tbl_name [, tbl_name] ... [ QUICK | EXTENDED ] ¶
<</code>> ¶
¶
== Description
¶
<<
useful if you want to know if two tables are the same (for example on a master
and slave). ¶
¶
With <<
available, or
<<fixed>>NULL<</fixed
checksum is enabled
option when you
only for Aria and
¶
With <<
checksum is
¶
If neither <<
specified, MariaDB returns a live
it and scans the table
¶
For a nonexistent table, <<
<<code>>NULL<</code>> and generates a
¶
== Differences between MariaDB and MySQL
¶
<<
ignore <<
versions should calculate checksums the same way as MariaDB). You can get the
'old style' checksum in MariaDB by starting mysqld with the
<<code>>--old<</
storage engines in MariaDB are using the new checksum internally, so if you are
using
slower as it needs to calculate the checksum row by row.
¶