//先进去MySQL自带管理库:information_schema
//自己的数据库:rokid_cas_music_test
//自己的表:data_song_thirdparty mysql> use information_schema;
Database changed
mysql> select data_length,index_length
from information_schema.tables where table_schema='rokid_cas_music_test' and table_name = 'data_song_thirdparty';

+-------------+--------------+
| data_length | index_length |
+-------------+--------------+
| 15993798656 | 8825700352 |
+-------------+--------------+
1 row in set (0.00 sec)

row in set (0.02 sec)  

mysql> select concat(round(sum(data_length//),),'MB') as data_length_MB,
concat(round(sum(index_length//),),'MB') as index_length_MB
from information_schema.tables where
table_schema='rokid_cas_music_test'
and table_name = 'data_song_thirdparty';

+----------------+-----------------+
| data_length_MB | index_length_MB |
+----------------+-----------------+
| 15252.88MB | 8416.84MB |
+----------------+-----------------+
1 row in set (0.01 sec)

row in set (0.03 sec)

查询MySQL数据库中每个数据库数据和索引所占的数据大小,单位G,保留两位小数

select table_schema,round(sum(data_length)/1024/1024/1024,3) as datasize, round(sum(index_length)/1024/1024/1024,3) as indexsize
from information_schema.tables
where table_schema != 'information_schema' and table_schema != 'mysql' and table_schema != 'performance_schema'
group by table_schema
order by datasize desc;

查询MySQL数据库中每个表的数据和索引所占的数据大小,单位G,保留两位小数

select table_schema,table_name,round(sum(data_length)/1024/1024/1024,3) as datasize, round(sum(index_length)/1024/1024/1024,3) as indexsize
from information_schema.tables
where table_schema != 'information_schema' and table_schema != 'mysql' and table_schema != 'performance_schema'
group by table_schema,table_name
order by datasize desc;

【转自】:http://www.cnblogs.com/qq78292959/archive/2012/12/26/2833698.html

【转】MySQL查看表占用空间大小(转)的更多相关文章

  1. MySQL查看表占用空间大小(转)

    MySQL查看表占用空间大小(转) //先进去MySQL自带管理库:information_schema //自己的数据库:dbwww58com_kuchecarlib //自己的表:t_carmod ...

  2. MySQL查看表占用空间大小

    需求:我们在选购服务器硬盘时,通常需要先估算一下数据量.比如我们现在做的项目,百万级用户,然后在现有的数据结构中插入一万条数据,然后根据相应的需求去计算出实际生产中的数据量. 前言:在mysql中有一 ...

  3. mysql查看表大小

    mysql查看表大小 一:命令 show table status like 'table_name'\G; mysql> show table status like 'x'\G; . row ...

  4. SQL2000查看表的大小

    SQL2000查看表的大小 标签: sqlsql server数据库报表tableinsert 2011-06-08 11:47 4013人阅读 评论(0) 收藏 举报 SQL2000查看表的大小 本 ...

  5. MySQL 查看表结构

    mysql查看表结构命令,如下: desc 表名; show columns from 表名; describe 表名; show create table 表名; use information_s ...

  6. mysql查看表结构命令

    mysql查看表结构命令 mysql查看表结构命令,如下: desc 表名;show columns from 表名;describe 表名;show create table 表名; use inf ...

  7. mysql查看表结构,字段等命令

    mysql查看表结构命令,如下: desc 表名; show columns from 表名; describe 表名; show create table 表名;

  8. 检测SQL Server表占用空间大小SQL

    检测SQL Server表占用空间大小SQL,要先选择需要查询的数据库,然后点击执行下面脚本. ),ROWS ),reserved ) ,Data ) ,index_size ) ,Unused ) ...

  9. Oracle 表的行数、表占用空间大小,列的非空行数、列占用空间大小 查询

    --表名,表占用空间大小(MB),行数select table_name, round(num_rows * avg_row_len /1024/1024, 8) as total_len, num_ ...

随机推荐

  1. iOS 持续集成

    iOS 持续集成系列 - 开篇 前言 iOS 开发在经过这几年的野蛮生长之后,慢慢地趋于稳定.无论开发语言是 Objective-C 还是 Swift,工程类型是 Hybird 还是原生,开发思想是 ...

  2. suricate学习笔记1--初步认识(转)

    最近在研究关于dpi网卡采集的代码重组这块,公司一个同事,简单的用CPP讲解了suricata内部的一些处理逻辑,,,其中大部分代码是用C语言写的,对于用C重构代码有很好的借鉴作用,,,如果有相关工作 ...

  3. java 取模运算% 实则取余 简述 例子 应用在数据库分库分表

    java 取模运算%  实则取余 简述 例子 应用在数据库分库分表 取模运算 求模运算与求余运算不同.“模”是“Mod”的音译,模运算多应用于程序编写中. Mod的含义为求余.模运算在数论和程序设计中 ...

  4. 利用图片中的exif元数据批量查找图片中所包含的GPS信息

    在图片的exif(交换图像文件格式)中标准定义了如何存储图像和音频文件的标准,而在这些标签中往往存在了一些容易被人们忽视却又重要的东西. 有一款工具名为exiftool,可以快速的解析所有标签,并将结 ...

  5. List<String> bikeList = Arrays.asList(bikeuuids);

    最近项目中  List<String> bikeList = Arrays.asList(bikeuuids);报错 而且console里面没有特别有用的 bikeList.add(&qu ...

  6. 【Android】Android 8种对话框(Dialog)

    1.写在前面 Android提供了丰富的Dialog函数,本文介绍最常用的8种对话框的使用方法,包括普通(包含提示消息和按钮).列表.单选.多选.等待.进度条.编辑.自定义等多种形式,将在第2部分介绍 ...

  7. IntelliJ IDEA 最新激活码(截止到2018年10月14日)

    IntelliJ IDEA 注册码: EB101IWSWD-eyJsaWNlbnNlSWQiOiJFQjEwMUlXU1dEIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYX ...

  8. log4j(四)——如何控制不同风格的日志信息的输出?

    一:测试环境与log4j(一)——为什么要使用log4j?一样,这里不再重述 二:老规矩,先来个栗子,然后再聊聊感受 import org.apache.log4j.*; //by godtrue p ...

  9. Spark技术栈

  10. C#数组之 []、List、Array、ArrayList应用

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...