Name

ANALYSE( )

Synopsis

ANALYSE([column[, memory]])

This function returns an analysis of a results table from a SELECT statement. The \G at the end of the following statement provides a vertical output. Use this function only as part of a PROCEDURE clause. The default values are 256 per column and 8,192 for memory.

SELECT col1
FROM table1
PROCEDURE ANALYSE( ) \G
*************************** 1. row ***************************
             Field_name: table1.col1
              Min_value: 1
              Max_value: 82
             Min_length: 1
             Max_length: 2
       Empties_or_zeros: 0
                  Nulls: 0
Avg_value_or_avg_length: 42.8841
                    Std: 24.7600
      Optimal_fieldtype: TINYINT(2) UNSIGNED NOT NULL

You can specify the maximum number of elements to analyze for each column in the optional first argument, and the maximum amount of memory that may be used in the optional second argument.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.