針對資料庫引擎:myisam和innodb.做了一些效能測試和比較。包括有沒有索引的情況下的比較。
主要是想證實一些效能問題。
資料量:6 millions, 機器:dell 2950
1. alter from innodb to myisam:
no index has two indexes
~1min30s ~9mins
2. load data into table:
no index has two indexes
innodb(no binlog) ~4mins ~10mins
myisam(no binlog) ~4mins ~10mins
3. select count(*) from table where id>0:
no indexes use index
innodb ~19 s ~3mins
myisam ~16 s ~4s
4. create index:
innodb ~12mins
myisam ~6mins20s
5. select * from table where id>0 limit 1000000,10
innodb ~3s
myisam ~8s
可以看出在資料量大的情況下,innodb常不會有很好的效能。特別是需要查詢大量資料,甚至全表掃瞄時。
因為myisam的資料是緊湊儲存的,所以查詢大量資料時需要的io數相對較少。所以比較快。
而innodb走的聚集索引,走索引不能多資料快io,所以就更慢了。
當然在少量資料定位時,特別是按主鍵查詢時,innodb的效能就更好了。
實驗中,innodb的匯入資料的速度並沒有比myisam慢,這讓我很奇怪。
總的來說,如果想要用mysql來儲存大量的資料,而且資料操作又經常需要提取大量的資料(超過5%),myisam可能更好。
分享到:
2010-05-08 17:24
瀏覽 1086
分類:資料庫
MySql效能測試
mysql版本 mysql引擎 表結構 資料量 3000萬條左右 1 使用primary key進行查詢 2 使用索引進行查詢 注意資料型別,如果查詢條件為account no 26850則不會走索引查詢 在1 2中如果有order by欄位,其生效於where刪選資料之後,所以如果where篩選後...
mysql效能測試
伺服器 cpu 2ghz,記憶體 4g,物理機 系統 centos 5 32位 網路 100mbps 區域網 客戶端 cpu 2ghz,記憶體 4g 系統 centos 5 32位 資料量 1000萬條記錄 mysql版本 5.1.51 log 測試方法 把mysql掛到dns軟體後面,用bind的...
mysql效能測試
伺服器 cpu 2ghz,記憶體 4g,物理機 系統 centos 5 32位 網路 100mbps 區域網 客戶端 cpu 2ghz,記憶體 4g 系統 centos 5 32位 資料量 1000萬條記錄 mysql版本 5.1.51 log 測試方法 把mysql掛到dns軟體後面,用bind的...