首页 > 编程知识 正文

oracle数据库sql优化,oracle优化查询速度

时间:2023-05-06 12:18:41 阅读:154441 作者:4197

(1) QPS (每秒的Query量) ) ) )。

QS=questions(orqueries )/seconds

mysqlshowglobalstatuslike ' question % ';

)2) TPS (每秒事务数) )。

TPS=(com_commitcom_rollback )/seconds

mysqlshowglobalstatuslike ' com _ commit ';

mysqlshowglobalstatuslike ' com _ roll back ';

)3)密钥缓冲区命中率

mysqlshow global status like 'key% ';

key _ buffer _ read _ hits=(1- key _ read )

s/key_read_requests ) * 100%

key _ buffer _ write _ hits=(1- key _ writes/key _ write _ requests ) * 100%

(4) innodb缓冲区命中率

mysqlshowstatuslike ' innodb _ buffer _ pool _ read % ';

innodb _ buffer _ read _ hits=(1- innodb _ buffer _ pool _ reads/innodb _ buffer _ pool _ read _ requests ) *

)5)查询缓存命中率

mysql show status like 'Qcache% ';

query_cache_hits=(qcahce_hits/) qcache_hitsqcache_inserts ) * 100%;

(6)表缓存状态量

mysqlshowglobalstatuslike ' open % ';

比较open_tables和opend_tables的值

(7) Thread Cache命中率

mysqlshowglobalstatuslike ' thread % ';

mysqlshowglobalstatuslike ' connections ';

thread _ cache _ hits=(1- threads _ created/connections ) * 100%

)8)锁定状态

mysqlshowglobalstatuslike ' % lock % ';

table _ locks _ waited/table _ locks _ immediate=0.3 %该比值较大时,表示表格锁定导致的堵塞严重

Innodb_row_lock_waits innodb低锁由于间隙锁而导致可能性过高

(9)复制延迟量

mysql show slave status

显示延迟时间

(10 ) Tmp Table状况(暂定表状况) ) ) ) ) ) ) )。

mysqlshowstatuslike ' create _ tmp % ';

created _ tmp _ disk _ tables/created_tmp_tables比率最好不要超过10%,在created _ tmp _ tables的值较大的情况下,

排序语句可能过多,或者连接语句可能未优化

(11 )二进制缓存的使用情况

mysqlshowstatuslike ' binlog _ cache % ';

如果Binlog_cache_disk_use的值不为0,则必须增加binlog_cache_size的大小

(12 ) Innodb_log_waits量

mysqlshowstatuslike ' innodb _ log _ waits ';

如果Innodb_log_waits的值不为0,则表示innodb log buffer因空间不足而正在等待

例如命令:

#show global status;

可以使用,但是:

#show global status like %.%;

我来过滤一下,对应于很长的list,需要弄清楚每个都表示什么意思。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。