程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> Mysql InnoDB筆記內存

Mysql InnoDB筆記內存

編輯:MySQL綜合教程

Mysql InnoDB筆記內存   InnoDB 狀態 Sql代碼   show engine innodb status\G;       執行結果 Type: InnoDB Name: Status: Per second averages calculated from the last 6 seconds ----------------- BACKGROUND THREAD ----------------- srv_master_thread loops: 0 srv_active, 0 srv_shutdown, 17509 srv_idle srv_master_thread log flush and writes: 17509 ---------- SEMAPHORES ---------- OS WAIT ARRAY INFO: reservation count 2 OS WAIT ARRAY INFO: signal count 2 Mutex spin waits 5, rounds 12, OS waits 0 RW-shared spins 2, rounds 60, OS waits 2 RW-excl spins 0, rounds 0, OS waits 0 Spin rounds per wait: 2.40 mutex, 30.00 RW-shared, 0.00 RW-excl ------------ TRANSACTIONS ------------ Trx id counter 17154 Purge done for trx's n:o < 14771 undo n:o < 0 state: running but idle History list length 588 LIST OF TRANSACTIONS FOR EACH SESSION: ---TRANSACTION 0, not started MySQL thread id 1, OS thread handle 0x8ac, query id 15 localhost 127.0.0.1 root init show engine innodb status -------- FILE I/O -------- I/O thread 0 state: wait Windows aio (insert buffer thread) I/O thread 1 state: wait Windows aio (log thread) I/O thread 2 state: wait Windows aio (read thread) I/O thread 3 state: wait Windows aio (read thread) I/O thread 4 state: wait Windows aio (read thread) I/O thread 5 state: wait Windows aio (read thread) I/O thread 6 state: wait Windows aio (write thread) I/O thread 7 state: wait Windows aio (write thread) I/O thread 8 state: wait Windows aio (write thread) I/O thread 9 state: wait Windows aio (write thread) Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] , ibuf aio reads: 0, log i/o's: 0, sync i/o's: 0 Pending flushes (fsync) log: 0; buffer pool: 0 312 OS file reads, 5 OS file writes, 5 OS fsyncs 0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s ------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX   性能  插入緩沖與自適應哈希    插入緩沖不是緩沖池的一部分.它使用於索引是輔助索引,且索引不是唯一的.因為如主鍵自增長則插入這個聚集索引按順序插入很快完成,但是如表另有不是唯一的非聚集索引,就需要對非聚集索引的葉子節點插入離散存儲B+樹. ------------------------------------- Ibuf: size 1, free list len 0, seg size 2, 0 merges     segSize:當前插入緩沖大小為2*16KB. free list 為空閒列表長度 size 為 已合並記錄頁為數量    insert 為插入記錄數,merged 合並的頁數量,merges合並次數 merged operations: insert 0, delete mark 0, delete 0 discarded operations: insert 0, delete mark 0, delete 0 Hash table size 553253, node heap has 1 buffer(s) 0.00 hash searches/s, 0.00 non-hash searches/s --- LOG --- Log sequence number 2122026419 Log flushed up to 2122026419 Pages flushed up to 2122026419 Last checkpoint at 2122026419 0 pending log writes, 0 pending chkp writes 8 log i/o's done, 0.00 log i/o's/second ---------------------- BUFFER POOL AND MEMORY ---------------------- Total memory allocated 135987200; in additional pool allocated 0 Dictionary memory allocated 32514 Buffer pool size 8192 Free buffers 7892 Database pages 299 Old database pages 0 Modified db pages 0 Pending reads 0 Pending writes: LRU 0, flush list 0 single page 0 Pages made young 0, not young 0 0.00 youngs/s, 0.00 non-youngs/s Pages read 299, created 0, written 1 0.00 reads/s, 0.00 creates/s, 0.00 writes/s No buffer pool page gets since the last printout Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s   LRU len: 299, 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 0 read views open inside InnoDB Main thread id 2708, state: sleeping Number of rows inserted 0, updated 0, deleted 0, read 0 0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s ---------------------------- END OF INNODB MONITOR OUTPUT ============================   InnoDB的內存 由緩沖池,重做日志緩沖池及額外的內存構成. Sql代碼   show variables like 'innodb_buffer_pool_size'\G;   134217728   show variables like 'innodb_log_buffer_size'\G;     8388608   show variables like 'innodb_additional_mem_pool_size'\G;     8388608    緩沖池是最大的部分,用來存放各種數據的緩存.引擎按頁16KB/每頁讀取到緩沖池,然後按LRU保留緩沖池中的數據.如果數據庫文件需要修改,先修改緩沖池中的頁,修改後即為髒頁,然後按一定的頻率將髒頁刷新到文件. Buffer pool size 8192 中的大小即可算出緩沖區 8192*16(KB/page)/1024 =? 緩沖池中緩存的數據類型有:索引頁,數據頁,UNDO頁,插入緩沖,自適應哈希索引,InnoDB鎖信息,數據字典等. AWE 開啟後引擎自動禁用自適應哈希索引. 日志緩沖將重做日志信息先放入這個緩沖區,再按一定的頻率將其刷新到重做日志文件.  

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved