Database
1. Query the size of all data: data_length: Data size index_length: Index size
SELECT concat (Round (sum (data_length+index_length)/1024/1024,2), ' MB ') as DATA from INFORMATION_SCHEMA. Tables\g
2. View the size of the specified database, such as the size of the database Zabbix:
SELECT concat (Round (sum (data_length+index_length)/1024/1024,2), ' MB ') as DATA from INFORMATION_SCHEMA. TABLES where table_schema= ' Zabbix ' \g
3. View the size of a table in the specified database, such as viewing the size of the history table in the database Zabbix
SELECT concat (Round (sum (data_length+index_length)/1024/1024,2), ' MB ') as DATA from INFORMATION_SCHEMA. TABLES where table_schema= ' Zabbix ' and table_name= ' History_uint ' \g
4. View all information related to the specified table
SELECT * FROM INFORMATION_SCHEMA. TABLES where table_schema= ' Zabbix ' and table_name= ' history ' \g
Table
1. Query the first line of records:
SELECT * from table limit 1;
2. Query the first n rows of records
SELECT * from table limit 10;
Or
SELECT * FROM table limit 0, 10;
MySQL Common query