Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the Wordpress database schema not use foreign keys? [closed]

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 ?

like image 316
Z4k4r14 Avatar asked Dec 03 '12 02:12

Z4k4r14


People also ask

Why foreign key is not recommended?

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.

Should you always use foreign keys?

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.

Can a relational database have no foreign keys?

There is no reason not to use Foreign Key Constraints, and to use a relational database.

What is restrict in foreign key?

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.


1 Answers

WordPress uses MyISAM, because of more functionality and better performance, but MyISAM did not support foreign keys. It was a trade off.

like image 102
GolezTrol Avatar answered Nov 15 '22 20:11

GolezTrol