1、索引相關
檢視表索引
show index from `user`
檢視sql的執行計畫
explain select * from where user
2、儲存過程相關
檢視儲存過程
show
procedure
status
檢視儲存過程aaa的ddl
show create procedure aaa
呼叫儲存過程
call aaa()
3、檢視資料庫的連線情況
show processlist;
4、檢視資料庫大小
mysql [information_schema]> select concat(round(sum(data_length/1024/1024), 2),'mb') as data from tables where table_schema='db_a';
mysql [information_schema]> select concat(round(sum(data_length/1024/1024), 2),'mb') as data from tables where table_schema='db_b';
mysql [information_schema]> select concat(round(sum(data_length/1024/1024),2),'mb') as data from tables;
select concat(round(sum(data_length/1024/1024),2),'m') from tables where table_schema=』資料庫名』 and table_name=』表名』;
select sum(data_length)+sum(index_length) from information_schema.tables where table_schema='資料庫名';
5、show engine innodb status 檢視引擎日誌,包含如下面內容,常用的比如檢視死鎖日誌
background thread
semaphores
latest detected deadlock
transactions
file i/o
insert buffer and adaptive hash index
logbuffer pool and memory
individual buffer pool info
row operations
6、information_schema中的三張表:innodb_trx、innodb_locks、innodb_lock_waits,通過這三張表,可以更簡單地監控當前的事務並分析可能存在的鎖等待問題。
比如直接查sql select * from innodb_trx,排查分析鎖等待的問題,可以查出有問題的事務,然後處理它,比如kill掉等操作
作業系統 雜記
空閒讓進,忙則等待,有限等待,讓權等待 當程序不能進入自己的臨界區,應該立即釋放處理機,以避免程序陷入忙等狀態。頁表是放在記憶體中,所以cpu訪問乙個資料時要兩次訪問記憶體。一次是訪問頁表,找到對應頁在記憶體中的位址。第二次是根據獲得的位址找到資料。為了提高位址變換速度,可以增加乙個具有並行查詢能力...
linux 檔案操作雜記
在linux 學習中,檔案操作是乙個十分重要的模組.通常,我們使用open 來開啟檔案.其實在open 的背後,有好多有 fu 趣 za 的事情發生.我們主要來講一下檔案描述符和檔案之間不可描述的關係.程序級別的檔案描述符表 檔案描述符在形式上是乙個非負整數。實際上,它是乙個索引值,指向核心為每乙個...
遺傳演算法的交叉變異操作雜記
100個個體,交叉概率為0.1,並不代表交叉個體數為10個.這是乙個概率問題.另外,交叉概率一般會取0.5 1這個範圍內,0.1未免有點小.自適應的遺傳演算法,一般在迭代初期會有較大的交叉概率,越往迭代後期,交叉概率越小.而變異概率則相反.標準的交叉如下 假設六個個體的編號為從1至6,兩兩配對共分為...