转  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. ValidList

    package com.dlzb.enterprising.config; import javax.validation.Valid; import java.util.*; public clas ...

  2. Froms

    首先看到的是一个输入框 不多说,直接bp抓下来 然后传repeater里,发现了pin值后showsource值,pin值没什么,应该是做题用的,而showsource是个隐藏的值,将其0改为1后go ...

  3. ElasticSearch7.6.1学习笔记-狂神

    ElasticSearch:7.6.1 https://gitee.com/yujie.louis/elastic-search 笔记,代码,安装包等 什么是ElasticSearch? Elasti ...

  4. ArcEngine要素编辑遇到的一些问题

    1.如何开启编辑 IMap myMap = this._Aplication.ActiveView.FocusMap; IWorkspace myWorkspace = (myMap25Sheet.P ...

  5. Service层

    package com.neu.service; import java.util.List; import com.neu.bean.User;import com.neu.dao.UserDao; ...

  6. referer的反爬和爬虫下载视频

    一.缘由 在梨视频等一些网站中会使用防盗链作为反爬的基础方法,这个反爬并不严重,只是平时的时候需要多加留意.此次实现对应链接中梨视频的下载. 二.代码实现 #1.拿到contid #2.拿到video ...

  7. intel Pin:动态二进制插桩的安装和使用,以及如何开发一个自己的Pintool

    先贴几个你可能用得上的链接 intel Pin的官方介绍Pin: Pin 3.21 User Guide (intel.com) intel Pin的API文档Pin: API Reference ( ...

  8. 秒级查询之开源分布式SQL查询引擎Presto实操-上

    @ 目录 概述 定义 概念 架构 优缺点 连接器 部署 集群安装 常用配置说明 资源管理安装模式 安装命令行界面 基于Tableau Web 连接器 使用优化 数据存储 查询SQL优化 无缝替换Hiv ...

  9. 痞子衡嵌入式:存储器大厂Micron的NOR Flash芯片特殊丝印设计(FBGA代码)

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家讲的是存储器大厂Micron的NOR Flash芯片特殊丝印设计(FBGA代码). 痞子衡之前写过一篇文章 <J-Flash在Micron ...

  10. 利用python数据分析

    利用python进行数据分析 本书由Python pandas项目创始人Wes McKinney亲笔撰写,详细介绍利用Python进行操作.处理.清洗和规整数据等方面的具体细节和基本要点.第2版针对P ...