开发者

Is Foreign Key field important?

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜