We have some tables, in which we didn't give any foreign key cons开发者_JS百科traints. So if we indexing those columns without giving foreign key constraints, is there any performance issue?
Indexes will increase your performance only if you are using the indexed columns in your queries. So index a column only if you are using that column frequently in the queries. The foreign key constraint has no relation for the column to be indexed.
Not defining a foreign key constraint on a column which is supposedly acting as foreign-key in your DB, then you will probably face data-integrity issues as already mentioned by @The scrum.
Depends on the query optimizer. Optimizers can make certain assumptions when they know about foreign key constraints. There used to be a bug in SQL Server's optimizer related to those assumptions.
But query performance isn't the real issue. Data integrity is the real issue.
Is it important to get the wrong answer really, really fast?
精彩评论