views:

40

answers:

2

I have two tables: Users and Friendships.
The actions I have in the website are:

  • Register
  • Log in
  • Select friends/people from users table
  • Add people as friends

There are a little more actions but in general i wanted to know :

The Question:

Should I use InnoDB or MyISAM for the tables ?
( Or InnoDB for one and MyISAM for the other ? )

+2  A: 

Always use InnoDB unless you specifically want to include a FULLTEXT index on a particular table. Only InnoDB enforces foreign keys, and the more referential integrity you can build into the database the better off everyone's going to be.

VoteyDisciple
thanks you very much!
+2  A: 

Use InnoDB. You get foreign key constraints, transactions (so you can insert into two tables and either they both get committed or neither, so you aren't left with inconsistent information).

However, there is another big advantage. InnoDB supports MVCC (multi-versioning concurrency). This means that, while a transaction is operating on a row, other transactions/statements can see the old value of the row. With MyISAM that operation would block. Less blocking means you can have more users operating concurrently on your data set.

Adrian Smith
and add innodb clustered primary key indexes for better performance !
f00