mysql.column_stats Table

MariaDB starting with 10.0.1

The mysql.column_stats table was introduced as part of the Engine-independent table statistics feature implemented in MariaDB 10.0.1.

The mysql.column_stats table is one of three tables storing data used for Engine-independent table statistics added in MariaDB 10.0.1. The others are mysql.table_stats and mysql.index_stats.The histogram fields were added in MariaDB 10.0.2 as part of the Histogram-based Statistics feature.

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

MariaDB starting with 10.4

In MariaDB 10.4 and later, this table uses the Aria storage engine.

MariaDB until 10.3

In MariaDB 10.3 and before, this table uses the MyISAM 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.
hist_typeenum('SINGLE_PREC_HB', 'DOUBLE_PREC_HB')YESNULLHistogram type. See the histogram_type system variable.
histogramvarbinary(255)YESNULL

It is possible to manually update the table. See Manual updates to statistics tables for details.

Comments

Comments loading...