1.开启和关闭mysql> set profiling=1;mysql> set profiling=0; information_schema 的 database 会建立一个PROFILING 的 table 记录. 2.执行一些语句(自定义语句)mysql>select * from navigation_sub where navPId<6 and navSName='公司介绍'; 3.查询语句执行时间mysql>show profiles; 扩展: mysql查询性…
前不久,遇见一些问题,要监控一下SQL的执行,看看是不是有哪些SQL是要去掉的之类的 于是我上网找啊找啊,给出来的结果都是一种,修改my.cnf文件 我按着网上的说法去做,结果我直接崩溃了, 也不知道是不是我的环境是自己编译安装的还是其他什么的,反正按照改了以后就是死活运行不起来 没办法,只好自己看看怎么弄了 这时想起了刚刚接触mysql时的一个SQL show variables like "%name%"; set names utf8; 瞬间明了,找到了一个在没有重启mysql就…
http://dev.mysql.com/doc/refman/5.0/en/innodb-record-level-locks.html InnoDB has several types of record-level locks including record locks, gap locks, and next-key locks. For information about shared locks, exclusive locks, and intention locks, see…
准备 建表与数据准备 #建表 create table department( id int, name varchar(20) ); create table employee( id int primary key auto_increment, name varchar(20), sex enum('male','female') not null default 'male', age int, dep_id int ); #插入数据 insert into department val…
单表查询的语法及关键字执行的优先级 单表查询语法 SELECT DISTINCT 字段1,字段2... FROM 表名 WHERE 条件 GROUP BY field HAVING 筛选 ORDER BY field LIMIT 限制条数 关键字执行的优先级 from where group by select distinct having order by limit 1.找到表:from 2.拿着where指定的约束条件,去文件/表中取出一条条记录 3.将取出的一条条记录进行分组g…