--查看锁定的 表select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJECT' --查看数据库IDselect DB_ID()--查看 未提交的事务select * from sys.dm_tran_locks where resource_type = 'OBJECT' and reso
收到报警某台mysql数据库慢查询数量超过5,登录上去看,发现阻塞的SQL全部是update,处于Updating状态 +---------+------+-----------+------+---------+------+----------+------------------------------------+ | ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO | +---------+------+-----------
每个mysql都有一个库information_schema,里面有一张表TABLES存储了所有数据库表的信息,因此,可以从这张表中查看数据库大小和表大小 查询数据库大小 ,),'GB') as data from information_schema.tables where table_schema='esb'; 查询数据库中表大小 ,),'GB') as data from information_schema.tables where table_schema='esb' and tab
查询数据库中所有表名select table_name from information_schema.tables where table_schema='csdb' and table_type='base table'; 查询指定数据库中指定表的所有字段名column_nameselect column_name from information_schema.columns where table_schema='csdb' and table_name='users'
查询数据库的占用 SELECT CONCAT(ROUND(SUM(index_length)/(1024*1024), 2), ' MB') AS 'Total Index Size' , CONCAT(ROUND(SUM(data_length)/(1024*1024), 2), ' MB') AS 'Total Data Size' FROM information_schema.TABLES where table_schema like 'edb_a%' ; 查询表的占用 SELECT
查询数据库中所有表名select table_name from information_schema.tables where table_schema='数据库名' and table_type='base table';查询指定数据库中指定表的所有字段名column_nameselect column_name from information_schema.columns where table_schema='数据库名' and table_name='表名'; #查看分布式系统中不同
查询数据库中所有表名 select table_name from information_schema.tables where table_schema='csdb' and table_type='base table'; 查询指定数据库中指定表的所有字段名 select column_name from information_schema.columns where table_schema='csdb' and table_name='users';
第一步:首先打开Mysql命令行,通过开始菜单-程序-MySql-Command line client,如图1-1所示: 图1-1 第二步:在命令中输入use information_schema 如图1-2所示: 图1-2 第三步:查看指定数据库的大小,输入如下语句: select concat(round(sum(DATA_LENGTH/1024/1024),2), 'MB') as data from TABLES where table_schema= 'offlineCollect
1.查询sjcenter数据库里开头为sj_demo和sj_onlyinv的所有表的总条数 select sum(table_rows) from (select table_name,table_rows from tables where TABLE_SCHEMA = 'sjcenter' order by table_rows desc) as b where b.table_name like 'sj_demo%' or b.table_name like 'sj_onlyinv'