Analizado los campos y tipos de datos en MariaDB

Con la sintaxis SELECT PROCEDURE ANALYSE  podemos obtener la respuesta de un query con los datos optimos en base a la consulta que hicimos y los datos presentes en la tabla, aca a un ejemplo:

 MariaDB [training]> select * from soccer_teams procedure analyse ();
 +-----------------------------------+--------------+------------+------------+------------+------------------+-------+-------------------------+--------+--------------------------------
 ----------+
 | Field_name                        | Min_value    | Max_value  | Min_length | Max_length | Empties_or_zeros | Nulls | Avg_value_or_avg_length | Std    | Optimal_fieldtype
 |
 +-----------------------------------+--------------+------------+------------+------------+------------------+-------+-------------------------+--------+--------------------------------
 ----------+
 | training.soccer_teams.id          | 1            | 2          |          1 |          1 |                0 |     0 | 1.5000                  | 0.5000 | ENUM('1','2') NOT NULL
 |
 | training.soccer_teams.countryid   | 1            | 2          |          1 |          1 |                0 |     0 | 1.5000                  | 0.5000 | ENUM('1','2') NOT NULL
 |
 | training.soccer_teams.soccer_team | Boca Juniors | Flamengo   |          8 |         12 |                0 |     0 | 10.0000                 | NULL   | ENUM('Boca Juniors','Flamengo')
 NOT NULL |
 | training.soccer_teams.founded     | 1895-11-17   | 1905-04-03 |         10 |         10 |                0 |     0 | 10.0000                 | NULL   | ENUM('1895-11-17','1905-04-03')
 NOT NULL |
 +-----------------------------------+--------------+------------+------------+------------+------------------+-------+-------------------------+--------+--------------------------------
 ----------+
 4 rows in set (0.04 sec)
mysql> select concat('KILL ',id ,' ', Command,';') from information_schema.processlist where Command='Sleep';
+--------------------------------------+
| concat('KILL ',id ,' ', Command,';') |
+--------------------------------------+
| KILL 142374 Sleep;                   |
+--------------------------------------+
1 row in set (0.00 sec)

About the Author