开发者

mysql table 2 unique column

开发者 https://www.devze.com 2023-02-19 17:24 出处:网络
I have a table, called tablen. It has this structure: CREATE TABLE `tablen` ( `a` int(11) unsigned not null,

I have a table, called tablen.

It has this structure:

CREATE TABLE `tablen` (
   `a` int(11) unsigned not null,
   `b` int(11) unsigned not null,
   unique key(a,b)
}

This table has 1 use. I hit it with a row of data. If it is found to be a new unique row not already in the table, it gets added, else I get the returned error code.

The main thing I guess is speed. I don't have the facility to stress test the setup at the moment and so...

What would you say is the best format for this table?

Inn开发者_JAVA百科odb or myisam?


If you have a lot of inserts and updates, go for InnoDB, because it has row locking. MyISAM has table locking, which means, the whole table gets locked when a record is inserted (queuing all other inserts). If you have far more selects than inserts/updates then use MyISAM which is usually faster there (if you also don't care for foreign keys).

0

精彩评论

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