mysql进阶_lesson8

新任务

  • 对新业务不熟悉的小朋友怎么通过查询来快速了解业务情况;
  • 快速统计各种DB的数据,表个数、每张表占用空间情况、引擎情况等

知识点

  • 通过表结构、简单查询来快速了解业务基本情况;
  • 通过字典表 information_schema来掌握库、表的统计信息;

上手操作

--了解库表的一些基本命令
use world;
show tables;
explain city;
show create table coutry;
select * from city where code='chn' limit 10;
select table_name,table_comment from information_schema.tables where table_schema='world';

--查看world库中表名
select table_schema,group_concat(table_name)
from information_schema.tables where table_schema='world';

--统计所有库下表的总数
select table_schema,count(*) from information_schema.tables group by 1;

--统计world下每张表的磁盘占用空间
select table_name,sum(data_length)/1024 size_KB
from information_schema.tables
where table_schema='world'
group by 1;

课程视频

mysql_upgrade_lesson8 on bilibili
mysql_upgrade lesson8 on xigua

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。