Subject | Foreign Key & Query Performance |
---|---|
Author | |
Post date | 2018-02-24T10:40:54Z |
Hello there,
I am having a doubt that if Foreign Key reduces Query Performance Or not.
My Environment is
FirebirdCS2.6 :-
Item Table :- 10 Records, PK - Itemcode Varchar(5);
BillDetail Table :- 10 Million Records (FK Selectivity - 0.0076, PK Selectivity - 0.000000076)
I am having FK between BillDetail.Itemcode And Item.Itemcode with FK every query is slow. but as i remove the FK and added Index with Itemcode&BillDetail_PK the queries are running lightning fast. But I prefer FK to be in Database with high performance queries.
Kindly share you suggestions and Feedbacks on the same.