From : http://religiose.iteye.com/blog/1685537 一,如何判断SQL的执行效率? 通过explain 关键字分析效率低的SQL执行计划. 比如: explain select sum(moneys) from sales a, company b where a.company_id = b.company_id and a.year = 2006; id : 1 select_type: SIMPLE table: type: 1.row: id s…
一.sql中使用正则表达式 select name,email from user where email Regexp "@163[.,]com$"; sql语句中使用Regexp对性能影响较大. 二.使用Rand()函数获取随机数据 rand();随机数函数 1.随机排序 mysql> select * from hello order by rand(); 2.随机列抽取3条 mysql> select * from hello order by rand() lim…