問題描述
我正在處理一個涉及大量數(shù)據(jù)庫寫入的項目,我會說(70% 插入和 30% 讀取).這個比率還包括我認(rèn)為是一次讀取和一次寫入的更新.讀取可能很臟(例如,我在讀取時不需要 100% 準(zhǔn)確的信息).
有問題的任務(wù)將每小時處理超過 100 萬次數(shù)據(jù)庫事務(wù).
我在網(wǎng)上閱讀了很多關(guān)于 MyISAM 和 InnoDB 之間差異的內(nèi)容,對于我將用于此任務(wù)的特定數(shù)據(jù)庫/表,MyISAM 似乎是我的明顯選擇.從我似乎正在閱讀的內(nèi)容來看,如果需要事務(wù),InnoDB 是很好的,因為支持行級鎖定.
有人對這種類型的負(fù)載(或更高)有任何經(jīng)驗嗎?MyISAM 是要走的路嗎?
我有簡要的 在表格中討論了這個問題,以便您可以決定是使用 InnoDB 還是 MyISAM.
以下是您應(yīng)該在哪種情況下使用哪個數(shù)據(jù)庫存儲引擎的小概述:
<前>MyISAM InnoDB----------------------------------------------------------------需要全文檢索 是 5.6.4----------------------------------------------------------------需要交易 是----------------------------------------------------------------頻繁選擇查詢 是----------------------------------------------------------------頻繁插入、更新、刪除 是----------------------------------------------------------------行鎖定(單表多處理) 是----------------------------------------------------------------關(guān)系基礎(chǔ)設(shè)計 是總結(jié)
- 幾乎在所有情況下,InnoDB 都是最好的選擇
- 但是,經(jīng)常閱讀,幾乎不寫,使用MyISAM
- 在 MySQL <= 5.5 中進(jìn)行全文搜索,使用 MyISAM
I'm working on a projects which involves a lot of database writes, I'd say (70% inserts and 30% reads). This ratio would also include updates which I consider to be one read and one write. The reads can be dirty (e.g. I don't need 100% accurate information at the time of read).
The task in question will be doing over 1 million database transactions an hour.
I've read a bunch of stuff on the web about the differences between MyISAM and InnoDB, and MyISAM seems like the obvious choice to me for the particular database/tables that I'll be using for this task. From what I seem to be reading, InnoDB is good if transactions are needed since row level locking is supported.
Does anybody have any experience with this type of load (or higher)? Is MyISAM the way to go?
I have briefly discussed this question in a table so you can conclude whether to go with InnoDB or MyISAM.
Here is a small overview of which db storage engine you should use in which situation:
MyISAM InnoDB ---------------------------------------------------------------- Required full-text search Yes 5.6.4 ---------------------------------------------------------------- Require transactions Yes ---------------------------------------------------------------- Frequent select queries Yes ---------------------------------------------------------------- Frequent insert, update, delete Yes ---------------------------------------------------------------- Row locking (multi processing on single table) Yes ---------------------------------------------------------------- Relational base design Yes
Summary
- In almost all circumstances, InnoDB is the best way to go
- But, frequent reading, almost no writing, use MyISAM
- Full-text search in MySQL <= 5.5, use MyISAM
這篇關(guān)于MyISAM 與 InnoDB的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!