This is a read-only copy of the MariaDB Knowledgebase generated on 2025-03-04. For the latest, interactive version please visit https://mariadb.com/kb/.

mysql.column_stats Table

The mysql.column_stats table is one of three tables storing data used for Engine-independent table statistics. The others are mysql.table_stats and mysql.index_stats.

It is populated when the ANALYZE TABLE statement is run, although not by default. See Collecting Statistics with the ANALYZE TABLE Statement for details.

Note that statistics for blob and text columns are not collected. If explicitly specified, a warning is returned.

It is possible to manually update the table and, unlike most system tables, there are some scenarios where this could be useful. See Manual updates to statistics tables for details.

This table uses the Aria storage engine.

The mysql.column_stats table contains the following fields:

FieldTypeNullKeyDefaultDescription
db_namevarchar(64)NOPRINULLDatabase the table is in.
table_namevarchar(64)NOPRINULLTable name.
column_namevarchar(64)NOPRINULLName of the column.
min_valuevarchar(255)YESNULLMinimum value in the table (in text form).
max_valuevarchar(255)YESNULLMaximum value in the table (in text form).
nulls_ratiodecimal(12,4)YESNULLFraction of NULL values (0- no NULLs, 0.5 - half values are NULLs, 1 - all values are NULLs).
avg_lengthdecimal(12,4)YESNULLAverage length of column value, in bytes. Counted as if one ran SELECT AVG(LENGTH(col)). This doesn't count NULL bytes, assumes endspace removal for CHAR(n), etc.
avg_frequencydecimal(12,4)YESNULLAverage number of records with the same value
hist_sizetinyint(3) unsignedYESNULLHistogram size in bytes, from 0-255, or, from MariaDB 10.8, number of buckets if the histogram type is JSON_HB.
hist_typeenum('SINGLE_PREC_HB', 'DOUBLE_PREC_HB') (>= MariaDB 10.8)
enum('SINGLE_PREC_HB', 'DOUBLE_PREC_HB','JSON_HB') (<= MariaDB 10.7)
YESNULLHistogram type. See the histogram_type system variable.
histogramblob (>= MariaDB 10.7)
varbinary(255) (<=MariaDB 10.7)
YESNULL
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.