当前位置:网站首页>mysql中查询多个表中的数据量
mysql中查询多个表中的数据量
2022-08-11 09:04:00 【微生鸿朗】
查询多个表中的数据量,有两种方式进行查询。
select
table_schema as '数据库' ,
table_name as '表名' ,
table_rows as '记录数量'
FROM information_schema.tables
where TABLE_SCHEMA = 'nfds'
AND table_name in
(
'Name1' ,
'Name2' ,
'Name3'
)
另外的一个方式是
Select count(*) from name1
Union select count(*) from name2
Union select count(*) from name3
这两种方式的话是有一点不同,后面一种的话是能记录数据库中所有的数据,前一种的话是不会主动更新相关的记录,在很多情况下会让数据库中数据少。
USE [test] -- 只需修改这里的库名
SELECT a.name table_name, -- 表名
a.crdate crdate, -- 建表时间
b.rows rows, -- 总行数
8*b.reserved/1024 reserved, -- 保留大小(MB)
rtrim(8*b.dpages/1024) used, -- 已使用大小(MB)
8*(b.reserved-b.dpages)/1024 unused -- 未使用大小(MB)
FROM sysobjects AS a
INNER JOIN sysindexes AS b ON a.id = b.id
WHERE ( a.type = 'u' )
AND ( b.indid IN ( 0, 1 ) )
ORDER BY a.name,b.rows DESC;
边栏推荐
猜你喜欢

OAuth Client默认配置加载

软件定制开发——企业定制开发app软件的优势

What should I do if the mysql data query causes the cup to be full because the query time span is too large

Inventorying Four Entry-Level SSL Certificates

向日葵安装教程--向日葵远程桌面控制

框架外的PHP读取.env文件(php5.6、7.3可用版)

tensorflow 基础操作1(tensor 基本属性 , 维度变换,数学运算)

Nuget can't find the package problem

基础SQL——DDL

基于 VIVADO 的 AM 调制解调(1)方案设计
随机推荐
基于 VIVADO 的 AM 调制解调(3)仿真验证
IPQ4019/IPQ4029 support WiFi6 MiniPCIe Module 2T2R 2×2.4GHz 2x5GHz MT7915 MT7975
2022年值得关注的NFT发展趋势
ES6:数值的扩展
最强大脑(2)
excel将数据按某一列值分组并绘制分组折线图
eureka和consul的区别
Openlayers Aggregate Graph, Weight Aggregate Graph, and Aggregate Graph Click Events
One network cable to transfer files between two computers
自定义卷积核的分组转置卷积如何实现?
redis模拟面试
mysql数据查询因为查询的时间跨度过大导致cup爆满应该怎么办
表达式必须具有与对应表达式相同的数据类型
For the first time, I suspect that there is a bug in selenium4 because the iframe element is not found?
Birth of the Go language
在软件工程领域,搞科研的这十年!
基于 VIVADO 的 AM 调制解调(1)方案设计
WordpressCMS主题开发01-首页制作
mysql添加用户以及设置权限
无代码平台助力中山医院搭建“智慧化管理体系”,实现智慧医疗