MySQL知識整理


安裝

centos安裝見

https://blog.csdn.net/wohiusdashi/article/details/89358071

https://blog.csdn.net/q258523454/article/details/84555847

命令

查看表的隔離級別

show variables like 'tx_isolation';

設置表的隔離級別

set tx_isolation='read-committed'

設置非自動提交

set @@autocommit=0;

參數

參數 參數的意義
innodb_version InnoDB引擎版本
tx_isolation 表的隔離級別
innodb_%io_threads IO線程數
innodb_old_blocks_pct LRU算法的midpoint位置,37則為尾端37%的位置
innodb_old_blocks_time 到達midpoint位置后,多久進入LRU熱端,單位ms
innodb_log_buffer_size redo重做日志緩沖的大小,單位字節
innodb_max_dirty_pages_pct 臟頁數量占比多少時,觸發checkpoint,默認75%
innodb_lock_wait_timeout 鎖等待超時時間 ,默認50s

引擎狀態參數

show engine innodb status;

運行結果


----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 137428992
Dictionary memory allocated 145204
Buffer pool size   8191


## Free列表中頁的數量

Free buffers       7813

## LRU列表中頁的數量
Database pages     378


Old database pages 0

## 臟頁:被修改的頁,也就是和磁盤中數據不一致的頁,需要checkpoint機制寫回磁盤
## 臟頁需要放到Flush列表,才會被寫回磁盤。臟頁也會存在於LRU列表。
## 臟頁數量
Modified db pages  0


Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0


## LRU列移動到前端的次數
Pages made young 0, not young 0


0.00 youngs/s, 0.00 non-youngs/s
Pages read 291, created 87, written 461
0.00 reads/s, 0.00 creates/s, 0.00 writes/s

## 緩沖池命中率
Buffer pool hit rate 1000 / 1000, young-making rate 0 / 1000 not 0 / 1000


Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s

## LRU頁的數量,unzipLRU頁的數量
LRU len: 378, unzip_LRU len: 0


I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
1 read views open inside InnoDB
Process ID=4452, Main thread ID=140129213609728, state: sleeping
Number of rows inserted 2100, updated 3, deleted 0, read 2478
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

InnoDB存儲引擎結構

緩沖池,數據頁、索引頁

checkpoint機制

索引

B+樹結構

按粒度分

  • 表鎖
  • 行鎖
  • 意向鎖
  • 間隙鎖

按性質分

  • 排他鎖
  • 共享鎖

事務

特性

  • 原子性
  • 一致性
  • 隔離性
  • 持久性

備份


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM