MySQL: Does foreign key reference/constraint speed up the query?
I'm wondering if adding foreign key constraints and references has any performance improvements in MySQL queries.
For example, let's say I've a posts table -
post_id | user_id | title | ....
and a users table
id | username | password | ....
and on this table, I define
foreign_key (user_id) references -> 'id' on users
Will this have any performance improvements over NOT adding the foreign key reference?
I researched this a bit on the Internet and found out that some of the articles claim that it does improve the performance; but don't mention why, and how. Would really appreciate if someone could explain this.
PS: The tables I'm talking about are all InnoDB.
0