Page 1 of 1

mySQL foreign keys

Posted: Wed Feb 28, 2007 1:07 pm
by GeXus
Does anyone know if this is supported in mySQL? Without innoDB.... which I'm not even entirely sure what that is.

Code: Select all

FOREIGN KEY (user_id) REFERENCES reviewing (user_id) on delete cascade
This would be amazing if supported!

Posted: Wed Feb 28, 2007 1:16 pm
by mikeq
With mysql you have different types of table that you can use.

myisam (default)
innodb
heap
ndb

innodb supports foreign keys i believe, ndb might also

Posted: Wed Feb 28, 2007 1:32 pm
by GeXus
mikeq wrote:With mysql you have different types of table that you can use.

myisam (default)
innodb
heap
ndb

innodb supports foreign keys i believe, ndb might also
Interesting, so if I wanted to do foreign keys I would use an innoDB type, is that commonly used? and is it packaged with mysql?

Posted: Wed Feb 28, 2007 1:38 pm
by GeXus
http://www.mysqlperformanceblog.com/200 ... ks-part-1/

Just read this article, appears that innoDB is substantially faster then myISAM

Posted: Wed Feb 28, 2007 1:58 pm
by feyd
The other engines can use foreign keys as well, although artificially created.

Posted: Wed Feb 28, 2007 4:51 pm
by GeXus
Well, I decided to give it a try, I changed all my tables to innodb and started using the constraints... i love it!