Today i check the tables of the wordpress database but i can't find foreign keys to relate tables , can anybody tell me why wordpress don't have foreign keys ?
Having active foreign keys on tables improves data quality but hurts performance of insert, update and delete operations. Before those tasks database needs to check if it doesn't violate data integrity. This is a reason why some architects and DBAs give up on foreign keys at all.
Yes, you should. Foreign keys are just constrains which helps you to make relationships and be sure that you have correct information in your database. You should use them to prevent incorrect data entry from whatsoever.
There is no reason not to use Foreign Key Constraints, and to use a relational database.
To set an existing foreign key action to RESTRICT , the foreign key constraint must be dropped and recreated. When a referenced foreign key is deleted or updated, all rows referencing that key are deleted or updated, respectively.
WordPress uses MyISAM, because of more functionality and better performance, but MyISAM did not support foreign keys. It was a trade off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With