转  https://www.cnblogs.com/ssslinppp/p/6178636.html
  
1.information_schema数据库
  对于mysql和Infobright等数据库,information_schema数据库中的表都是只读的,不能进行更新、删除和插入等操作,也不能加触发器,因为它们实际只是一个视图,不是基本表,没有关联的文件。
  
2.information_schema.tables
information_schema.tables存储了数据表的元数据信息,下面对常用的字段进行介绍:
  • table_schema: 记录数据库名
  • table_name: 记录数据表名
  • engine : 存储引擎
  • table_rows: 关于表的粗略行估计;
  • data_length : 记录表的大小(单位字节);
  • index_length : 记录表的索引的大小
  • row_format: 可以查看数据表是否压缩过;
 
  
3.下面介绍几种常见的用法;

information_schema.tables信息;

  1. use information_schema;
  2. show create table tables;
  1. desc tables;

查询所有的数据库信息

  1. select distinct TABLE_SCHEMA from tables ;

查询数据库和数据表信息

显示mysql数据库下面的所有表信息:(共对比使用)
  1. use mysql;
  2. show tables;
通过information_schema.table获取数据库和数据表信息:
  1. use information_schema;
  2. select TABLE_SCHEMA ,table_name from tables where table_schema like 'mysql';

数据表大小以及索引大小

示例1:mysql.time_zone相关表
获取time_zone相关表的大小:
  1. select (sum(DATA_LENGTH) + sum(INDEX_LENGTH)) as size from tables where table_schema='mysql' and table_name like 'time_%';
 
示例2: 获取指定数据库的大小;
  1. select (sum(DATA_LENGTH) + sum(INDEX_LENGTH)) as size from tables where table_schema='mysql';

判断myisam数据表是否已压缩

  1. select distinct row_format,engine from information_schema.tables where engine='myisam';
  • Fixed: 表示已压缩;
  • Dynamic:表示未压缩;
 
  1. select row_format,engine,table_name from information_schema.tables where engine='myisam';

通过Linux指令直接获取数据库和数据表信息:

  1. mysql -uroot -pxxxx -D:表示数据库名称
  2.  
  3. -e:表示需要执行的指令:


元数据库 information_schema.tables的更多相关文章

  1. 【mysql元数据库】使用information_schema.tables查询数据库和数据表信息

    概述 对于mysql和Infobright等数据库,information_schema数据库中的表都是只读的,不能进行更新.删除和插入等操作,也不能加触发器,因为它们实际只是一个视图,不是基本表,没 ...

  2. (转)【mysql元数据库】使用information_schema.tables查询数据库和数据表信息 ---数据记录大小统计

    转:https://www.cnblogs.com/ssslinppp/p/6178636.html https://segmentfault.com/q/1010000007268994?_ea=1 ...

  3. MySQL元数据库——information_schema

    平时使用MySQL客户端操作数据库的同学,只要稍微留神都会发现,除了我们建的库之外,还经常看到三个数据库的影子: 1. information_schema 2. performance_schema ...

  4. mysql performance_schema 和information_schema.tables了解

    这个是关于mysql的系统表,性能表,核心表操作的一些介绍,深入算不上 我们一般很少去动 mysql  information_schema 信息相关  performance_schema 性能相关 ...

  5. information_schema.TABLES

    获取所有表结构(TABLES) SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA='数据库名'; TABLES表:提供了关于数据库中 ...

  6. 关于mysql中information_schema.tables

    项目中出现这样一个SQL语句,现记录如下: @Select("select table_name tableName, engine, table_comment tableComment, ...

  7. [Illuminate\Database\QueryException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using pas sword: NO) (SQL: select * from information_schema.tables where table_schema = la

    [Illuminate\Database\QueryException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost ...

  8. 【整理】mysql中information_schema.tables字段说明

    [整理]mysql中information_schema.tables字段说明 2016-05-04 16:47:50|  分类: 默认分类|举报|字号 订阅     下载LOFTER我的照片书  | ...

  9. InnoDB INFORMATION_SCHEMA Tables about Compression

    InnoDB INFORMATION_SCHEMA Tables about Compression 了解关于压缩的InnoDB INFORMATION_SCHEMA表,可以深入了解压缩的整体运行情况 ...

  10. mysql中information_schema.tables字段说明

      1. 获取所有表结构(TABLES) SELECT  *  FROM information_schema.TABLES WHERE  TABLE_SCHEMA='数据库名';  TABLES表: ...

随机推荐

  1. 实现Swaggera的在线接口调试

    1.访问Swagger的路径是:http://localhost:8080/swagger-ui.html 如果项目正常,则可看到如下界面: 2.点开下面的随意一个方法 如add添加数据的方法,展开: ...

  2. K8S之prometheus-operator监控

    prometheus-operator 1. Prometheus Operator介绍 介绍文章:http://t.zoukankan.com/twobrother-p-11164391.html ...

  3. 2022春每日一题:Day 29

    题目:Mishka and Interesting sum 这题稍微分析就能发现实际这个题就是求区间异或和异或上区间不同数的异或和,因此直接转化为HH的项链. 代码: #include <cst ...

  4. Go语言核心36讲09

    从本篇文章开始,我们正式进入了模块2的学习.在这之前,我们已经聊了很多的Go语言和编程方面的基础知识,相信你已经对Go语言的开发环境配置.常用源码文件写法,以及程序实体(尤其是变量)及其相关的各种概念 ...

  5. golang基础语法学习

    1.函数作为一等公民 2.驼峰命名法/大小写决定是否在包外见 3.包名应该是小写的单个单词命名 4. 包名应为其源码的基础名称,如encoding/base64,包名应为base64而不是encodi ...

  6. JavaSE -进阶基础---反射技术

    反射常见用法: Java 反射机制是在运行状态中,对于任意一个类,都能够获得这个类的所有属性和方法,对于任意一个对象都能够调用它的任意一个属性和方法.这种在运行时动态的获取信息以及动态调用对象的方法的 ...

  7. jsp 页面返回、本页面刷新

    返回上一页面: window.history.go(-1);  //返回上一页window.history.back();  //返回上一页 返回上一页面并对上一页面刷新: history.go(-1 ...

  8. python安装包出现的两个问题error: Unable to find vcvarsall.bat、提示No module named Crypto.Cipher

    python安装包出现的两个问题 error: Unable to find vcvarsall.bat No module named Crypto.Cipher error: Unable to ...

  9. PyQt4编写界面的两种方式

    PyQt4编写界面的两种方式 应用PyQt4开发图形化界面有两种方式,一种是直接通过QtDesigner通过提供的窗口部件拖拽进行GUI创建,另外一种是直接进行编程实现. 第一种,QtDesigner ...

  10. 可视化软件Navicat,python操作MySQL

    可视化软件Navicat 第三方开发的用来充当数据库客户端的简单快捷的操作界面 无论第三方软件有多么的花里胡哨,底层的本质还是SQL 能够操作数据库的第三方可视化软件有很多,其中针对MySQL最出名的 ...