Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

MySQL DOES have support for foreign keys.

create table foo (blah, blah, blah) engine = innodb

Sorry, I'm not trying to start an argument. That sentence just struck me as a bit inflammatory.



The GP's point is that the default engine, and hence the one used by probably 90+% of people using MySQL doesn't support FKs and other "standard" data integrity features that you wouldn't even know to ask about, since every other major db supports them by default.

Plus if you try to create an FK on a myisam backed table it happily runs the SQL, without errors, and you think you have a working FK.


It's more like the "default default" -- you can change it so, by default, every table is created using InnoDB. IIRC, MySQL comes with an example config that demonstrates just that.


I'd bet 90%+ of companies using MySQL for anything serious are using InnoDB.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: