selectp.id,p.user,p.host,p.db,p.command,p.time,i.trx_state,i.trx_started,p.info
from information_schema.processlistp,information_schema.innodb_trx iwherep.id=i.trx_mysql_thread_id;
查看库中所有表的大小
select table_name,concat(round(sum(DATA_LENGTH/1024/1024),2),'M')
from information_schema.tableswhere table_schema='t1'groupby table_name;
查看库中有索引的表
select TABLE_SCHEMA,TABLE_NAME,group_concat(INDEX_NAME) from information_schema.STATISTICSwhere
TABLE_SCHEMA notin ('sys','mysql','information_schema','performance_schema')
groupby TABLE_NAME ;
查看库中没有索引的表
select TABLE_SCHEMA,TABLE_NAME from information_schema.tableswhere TABLE_NAME notin (selectdistinct(any_value(TABLE_NAME))
from information_schema.STATISTICSgroupby INDEX_NAME)
and TABLE_SCHEMA notin ('sys','mysql','information_schema','performance_schema');
以上是编程学习网小编为您介绍的“mysql语法中有哪些查询方法”的全面内容,想了解更多关于 mysql 内容,请继续关注编程基础学习网。