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.
Replies
You are reading an archived discussion.
Related Posts
hi, i am using word press to make one site, so i want one functionality in which if user go to suppose blog page mysitename/blog/ he will be redirected to...
I'm electical graduate and I have 2 yr work experience in switchyard maintenance as deputy site incharge, but now I m finding new job like this , or which course...
I completed b.tech .but I have a backlogs in b.tech , I have sufficient knowledge on programming ,so i am interested to get a job in MNC . Is there...
stucked while studying due to various doubts come to my mind at that time
Manufacturer uses 8 cylinder for 3200cc engine. why they are not using single big cylinder Having 3200 cc engine capacity?