---
title: "mysql tps qps"
author: "javafan_303"
date: "2012-11-12T11:49:32Z"
tags: []
categories: ["数据库"]
slug: "mysql-tps-qps"
draft: false
lastmod: "2012-11-12T11:49:32Z"
id: 1722788
url: "https://cailin.iteye.com/blog/1722788"
---

TPS - Transactions Per Second（每秒传输的事物处理个数），即[**服务器**](http://space.itpub.net/21601207/viewspace-741749)每秒处理的事务数，如果是InnoDB会显示，没有InnoDB就不会显示。  
TPS = (COM\_COMMIT + COM\_ROLLBACK)/UPTIME

use information\_schema;  
select VARIABLE\_VALUE into @num\_com from GLOBAL\_STATUS where VARIABLE\_NAME ='COM\_COMMIT';  
select VARIABLE\_VALUE into @num\_roll from GLOBAL\_STATUS where VARIABLE\_NAME ='COM\_ROLLBACK';  
select VARIABLE\_VALUE into @uptime from GLOBAL\_STATUS where VARIABLE\_NAME ='UPTIME';  
select (@num\_com+@num\_roll)/@uptime;

QPS - Queries Per Second（每秒查询处理量）MyISAM 引擎  
QUESTIONS/UPTIME

use information\_schema;  
select VARIABLE\_VALUE into @num\_queries from GLOBAL\_STATUS where VARIABLE\_NAME ='QUESTIONS';  
select VARIABLE\_VALUE into @uptime from GLOBAL\_STATUS where VARIABLE\_NAME ='UPTIME';  
select @num\_queries/@uptime;