开发者

Should I use InnoDB or MyISAM for a "write-only" table?

开发者 https://www.devze.com 2023-01-19 10:45 出处:网络
I have a table where I\'m esentially only writing. Think of it as a \"transactions\" list, where开发者_如何学Go I keep all the details, and I also have a \"total\" stored in another table. That tota

I have a table where I'm esentially only writing.

Think of it as a "transactions" list, where开发者_如何学Go I keep all the details, and I also have a "total" stored in another table. That total is redundant, for performance, but it can be re-calculated if needed from this transactions table.

What is better from a performance point of view, keeping in mind that several people will be simultaneoulsy INSERTing (never UPDATEing) to this table, which is never ever read?

Should I use InnoDB, or MyISAM?

(I'm already having performance problems here, i'm not prematurely optimizing)


Use the ARCHIVE storage method for this. It's made for precisely this kind of of write-many read-almost-never application.


Usually you would use MyISAM for tables that only ever grow. MyISAM also has the advantage of supporting MERGE tables, so you don't have to have just one enormous table.

But, if you are "never" going to read from it, why use a table at all? Just write directly to a file. I'm curious what your performance issues are. You might look into the Blackhole table type with replication. Blackhole on the master, MyISAM or Archive on the slave.


You could also use MyISAM with INSERT DELAYED to instantly return from your insert and have mysql insert that data when its idle in a separate thread. It would speed up the insert from an application point of view, avoid insert contention. However opens you up to inconsistent data if the server crashed before writing...

0

精彩评论

暂无评论...
验证码 换一张
取 消