show innodb status (mysql)
当前活跃的事务:
------------
TRANSACTIONS
------------
Trx id counter080157601
Purge done for trx's n:o <0 80154573 undo n:o <0 0
History list length 6
Total number of lock structs in row lock hash table 0
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0 0, not started, process no 3396, OS thread id 1152440672
MySQL thread id 8080, query id 728900 localhost root
show innodb status
---TRANSACTION 0 80157600, ACTIVE 4 sec, process no 3396, OS thread id 1148250464, thread declared inside InnoDB 442
mysql tables in use 1, locked 0
MySQL thread id 8079, query id 728899 localhost root Sending data
select sql_calc_found_rows * from b limit 5
Trx read view will not see trx with id>= 0 80157601, sees <0 80157597
---TRANSACTION 0 80157599, ACTIVE 5 sec, process no 3396, OS thread id 1150142816 fetching rows, thread declared inside InnoDB 166
mysql tables in use 1, locked 0
MySQL thread id 8078, query id 728898 localhost root Sending data
select sql_calc_found_rows * from b limit 5
Trx read view will not see trx with id>= 0 80157600, sees <0 80157596
---TRANSACTION 0 80157598, ACTIVE 7 sec, process no 3396, OS thread id 1147980128 fetching rows, thread declared inside InnoDB 114
mysql tables in use 1, locked 0
MySQL thread id 8077, query id 728897 localhost root Sending data
select sql_calc_found_rows * from b limit 5
Trx read view will not see trx with id>= 0 80157599, sees <0 80157595
---TRANSACTION 0 80157597, ACTIVE 7 sec, process no 3396, OS thread id 1152305504 fetching rows, thread declared inside InnoDB 400
mysql tables in use 1, locked 0
MySQL thread id 8076, query id 728896 localhost root Sending data
select sql_calc_found_rows * from b limit 5
Trx read view will not see trx with id>= 0 80157598, sees <0 80157594
如果连接数量很大,InnoDB只能打印出其中的一部分,以维持整个列表的长度。
Transaction id是当前事务的标识符。Purge done for trx's n:o是回收程序启动事务的数量。如果回收程序没有运行事务,InnoD
相关文档:
MySQL优化
同时在线访问量继续增大,对于1G内存的服务器明显感觉到吃力严重时甚至每天都会死机,或者时不时的服务器卡一下,这个问题曾经困扰了我半个多月。MySQL使用是很具伸缩性的算法,因此你通常能用很少的内存运行或给MySQL更多的被存以得到更好的性能。
安装好mysql后,配制文件应该在/usr/local/mysql/share/mysql ......
在PHP代码段前面运行以下语句
@mysql_connect($host,$user,$password);
@mysql_query('SET NAMES "UTF8"');
@mysql_query('SET COLLATION_CONNECTION=utf8_general_ci');
或者在MYSQL中运行一次:
SET NAMES "UTF8";
SET COLLATION_CONNECTION=utf8_general_ci
一劳永逸
......
MYSQL自增列
1.关键字 :auto_increment
2.自增用法
例:
CREATE TABLE animals ( id mediumint not null auto_increment,
name char(30) not null,
primary key (id));
3.关于自增
Q:怎么获得当前的自增的最大值?
A:select @@identity
Q:怎么获得table的当前自增最大值?
A:select max(id) from table ......
一 UNION语法
代码 复制代码
SELECT ...
UNION [ALL | DISTINCT]
SELECT ...
[UNION [ALL | DISTINCT]
SELECT ...]
SELECT ... UNION [ALL | DISTINCT] SELECT ... [UNION [ALL | DISTINCT] SELECT ...]
UNION用于把 ......
mysqladmin extended (绝对值)
重点去监视的值有:
* Slave_running:如果系统有一个从复制服务器,这个值指明了从服务器的健康度
* Threads_connected:当前客户端已连接的数量。这个值会少于预设的值,但你也能监视到这个值较大,这可保证客户端是处在活跃状态。
* Threads_running:如果数据库超负荷了,你将会得到一个 ......