Should I use MyISAM or InnoDB Tables for my MySQL Database?

后端 未结 4 2155
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 01:34

I have the following two tables in my database (the indexing is not complete as it will be based on which engine I use):

Table 1:



        
4条回答
  •  感动是毒
    2020-12-06 02:27

    MyISAM won't enable you to do mysql level check. For instance if you want to update the imgId on both tables as a single transaction:

    START TRANSACTION;
    UPDATE primary_images SET imgId=2 WHERE imgId=1;
    UPDATE secondary_images SET imgId=2 WHERE imgId=1;
    COMMIT;
    

    Another drawback is integrity check, using InnoDB you can do some error check like to avoid duplicated values in the field UNIQUE KEY imgDate (imgDate). Trust me, this really come at hand and is way less error prone. In my opinion MyISAM is for playing around while some more serious work should rely on InnoDB.

    Hope it helps

提交回复
热议问题