Reputation: 2336
I got a habit to use INT field for foreign ID (INT CommentID, INT TopicID, etc)
But I never use Foreign Key field, is this better?
Is it possible to change my currents database design in some tables to Foreign Key field? I already have over thousands data in the tables.
Upvotes: 1
Views: 470
Reputation: 300529
Foreign Keys constraints are very important. They enforce domain relationships between your entities. (It's no fun working with a database that contains orphaned or incomplete data).
Even in the less likely scenario of a high write to read ratio database, it's still best to include all FKs, and only remove them individually if they can be proven to be hurting INSERT performance.
In addition, they may allow the query optimiser to make extra performance optimisations.
Upvotes: 2