---
title: "查看数据表大小"
author: "ww111"
date: "2013-07-06T12:50:54Z"
tags: []
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2013-07-06T12:50:54Z"
id: 1900491
url: "https://ww111.iteye.com/blog/1900491"
---

```
// 表
select TABLE_NAME AS '表名',DATA_LENGTH/1024/1024 AS '数据大小(M)', INDEX_LENGTH/1024/1024 AS '索引大小(M)',TABLE_ROWS/10000 AS '数据量(万)'  from information_schema.TABLES where information_schema.TABLES.TABLE_SCHEMA = 'duobaohui' and information_schema.TABLES.TABLE_NAME = 'comment'\G;

// 数据库
select concat(round(sum(data_length/1024/1024),2),'MB') as '数据库大小' from tables where table_schema='duobaohui';
```