MySQL统计所有表的数据量
<p>MySQL统计所有表的数据量</p>
<h2>方法一</h2>
<p>mysql统计库下所有表数据行数
一、执行下面sql</p>
<p>select concat(
'select "',
TABLE_name,
'", count(*) from ',
TABLE_SCHEMA,
'.',
TABLE_name,
' union all'
) from information_schema.tables
where TABLE_SCHEMA='yl'; --库名</p>
<p>二、执行上面sql后会批量生成sql
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0bedfd36e14a2fae4ce832830217a620" alt="" /></p>
<p>三、把生成的sql拷出来,并去掉最后的一个“union all”:
<img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/9fdca9c905cbe4ac7090fe83ac968e2f" alt="" /></p>