Mysql常用指令記錄

進行開發時常用命令一次性輸入:

set autocommit=0;

set session transaction isolation level read committed;

SET GLOBAL binlog_format = 'ROW';

 


事務級別
1.查看當前會話隔離級別   select @@tx_isolation;
 
2.查看系統當前隔離級別   select @@global.tx_isolation;
 
3.設置當前會話隔離級別   set session transaction isolation level read committed;
 
4.設置系統當前隔離級別   set global transaction isolation level read committed;


自動提交
select @@autocommit;   //查詢


MY.CNF詳解
http://www.cnblogs.com/captain_jack/archive/2010/10/12/1848496.html


binary log 整理:
http://zhengdl126.iteye.com/blog/1522197


組合索引淺析
http://database.ctocio.com.cn/353/11664853.shtml


常用工具 
http://www.hackbase.com/tech/2010-09-16/61256.html



技巧:

CURRENT_DATE 這種“看似”常量的數據,其實是影響SQL進行緩存的,所以併發量大的場景,可以考慮以一個常量,每天0點更新獲取CURRENT_DATE緩存起來 


查看錶所佔空間:

//先進去MySQL自帶管理庫:information_schema   
//自己的數據庫:dbwww58com_kuchecarlib   
//自己的表:t_carmodelparamvalue  
 
.mysql> select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB,  
     concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB  
     from tables where  
    table_schema='dbwww58com_kuchecarlib'  

    and table_name = 't_carmodelparamvalue';  




查詢緩存配置參數:
SHOW VARIABLES LIKE '%cache%';


查詢緩存命中狀態:
SHOW STATUS LIKE '%Qcache%';





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章