标签:
1. 查询所有数据的大小: DATA_LENGTH: 数据大小 INDEX_LENGTH: 索引大小
SELECT concat(round(sum(DATA_LENGTH+INDEX_LENGTH)/1024/1024,2),‘MB‘) as data FROM information_schema.TABLES\G
2. 查看指定数据库的大小,比如查看数据库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. 查看指定数据库的某个表的大小,比如查看数据库zabbix中history表的大小
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. 查看指定表相关所有信息
select * from information_schema.TABLES where TABLE_SCHEMA=‘zabbix‘ AND TABLE_NAME=‘history‘\G
1. 查询第一行记录:
select * from table limit 1;
2. 查询前n行记录
select * from table limit 10;
或者
select * from table limit 0,10;
标签:
原文地址:http://www.cnblogs.com/heafod/p/5156197.html