ANALYSE( )

This MySQL function returns an analysis of a results table from a SELECT statement.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

ANALYSE([maximum_elements[, maximum_memory]])

Explanation

This function returns an analysis of a results table from a SELECT statement. Use this function only as part of a PROCEDURE clause. The first parameter is the maximum number of unique values that may be analyzed for each column; the default is 256. The second parameter is the maximum memory that should be allocated for each column during analysis; the default is 8,192 bytes (8 MB).

Examples

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