﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Database Design / Design Ideas and Questions  / Foreign Key Constraints and Performace! / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 25 May 2013 18:02:46 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Foreign Key Constraints and Performace!</title><link>http://www.sqlservercentral.com/Forums/Topic947462-373-1.aspx</link><description>For well designed relational databases, foreign key (FK) constraints are not optional. They play a significant role in maintaining referential integrity. Having stated that principle, it is possible to place too many FK constraints on a given table and significantly degrade performance. However, this is most often a symptom of poor database design and not an indictment of FK constraints.If you are concerned that specific FK constraints may degrade performance, then generate and examine the query execution plans for all related CRUD statements.If the evidence points to FK constraints as being the root cause of the bottleneck, then refactor the physical database schema with the aim to reduce the number of FK constraint on a given table, but without sacrificing overall referencial integrity (enforced by the FKs).</description><pubDate>Thu, 08 Jul 2010 10:04:32 GMT</pubDate><dc:creator>charlesbc</dc:creator></item><item><title>RE: Foreign Key Constraints and Performace!</title><link>http://www.sqlservercentral.com/Forums/Topic947462-373-1.aspx</link><description>[quote][b]Abrar Ahmad_ (7/6/2010)[/b][hr]Do overhead of constraints is same for all CRUD Operations. Or there are some differences?[/quote]No doubt a select statement on a single table will show no overhead because of Referential Integrity   :-)In regards of Insert, Update and Delete operations it all depends on the RI overall structure.Inserting a row in a table where RI forces RDBMS engine to check the existance of - lets say 10 parent records in 10 different tables will have more impact than inserting a row in a table where rows have just one parent. The same applies to update and delete operations.</description><pubDate>Wed, 07 Jul 2010 14:48:07 GMT</pubDate><dc:creator>PaulB-TheOneAndOnly</dc:creator></item><item><title>RE: Foreign Key Constraints and Performace!</title><link>http://www.sqlservercentral.com/Forums/Topic947462-373-1.aspx</link><description>[quote][b]PaulB-TheOneAndOnly (7/5/2010)[/b][hr]FKs certainly add overhead but I would refrain myself of saying that FK implementation is fatal in terms of performance.Having said that I have seen critical, high end systems - 60K+ executions per second - where each millisecond counted then no PK/FK was defined. In this case PKs got replaced by unique indexes and RI was enforced at the app side.Hope this helps.[/quote][font="Verdana"]Thanks Paul,Do overhead of constraints is same for all CRUD Operations. Or there are some differences?[/font]</description><pubDate>Tue, 06 Jul 2010 03:00:08 GMT</pubDate><dc:creator>Abrar Ahmad_</dc:creator></item><item><title>RE: Foreign Key Constraints and Performace!</title><link>http://www.sqlservercentral.com/Forums/Topic947462-373-1.aspx</link><description>[quote][b]Abrar Ahmad_ (7/5/2010)[/b][hr]Do Foreign key constraint implementation is fatal in terms of performance [/quote]FKs certainly add overhead but I would refrain myself of saying that FK implementation is fatal in terms of performance.Having said that I have seen critical, high end systems - 60K+ executions per second - where each millisecond counted then no PK/FK was defined. In this case PKs got replaced by unique indexes and RI was enforced at the app side.[quote][b]Abrar Ahmad_ (7/5/2010)[/b][hr]My design strategy for a medium level transactional DB (10 K - 500 K data records/Day) would be to not implement foreign key constraints?[/quote]There is a big difference in between 10K and 500K inserts nevertheless I agree with Gail this is not a large volume and provided hardware is appropriate I would enforce referential integritiy on the backend e.g. define PKs/FKs as business rules ask for.Hope this helps.</description><pubDate>Mon, 05 Jul 2010 08:15:14 GMT</pubDate><dc:creator>PaulB-TheOneAndOnly</dc:creator></item><item><title>RE: Foreign Key Constraints and Performace!</title><link>http://www.sqlservercentral.com/Forums/Topic947462-373-1.aspx</link><description>[quote][b]Abrar Ahmad_ (7/5/2010)[/b][hr]My design strategy for a medium level transactional DB (10 K - 500 K data records/Day) would be to not implement foreign key constraints?[/quote]Half a million records a day is not a high-volume SQL database, not on appropriate hardware. There's no need to go to extreme measures (like dropping constraints) on a transactional volume that small.</description><pubDate>Mon, 05 Jul 2010 05:12:49 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Foreign Key Constraints and Performace!</title><link>http://www.sqlservercentral.com/Forums/Topic947462-373-1.aspx</link><description>If you have a relational databae then you need to have FK constraints, without them you may as well look at column database.The FK can impact perfromance,  however they can also be used by the Query Optimizer for optimizing queries.</description><pubDate>Mon, 05 Jul 2010 04:58:14 GMT</pubDate><dc:creator>steveb. </dc:creator></item><item><title>Foreign Key Constraints and Performace!</title><link>http://www.sqlservercentral.com/Forums/Topic947462-373-1.aspx</link><description>[font="Verdana"]Do Foreign key constraint implementation is fatal in terms of performance (keeping in view all CRUD Operations).My design strategy for a medium level transactional DB (10 K - 500 K data records/Day) would be to not implement foreign key constraints?How we can set any tradeoff between these two concerned factors.Waiting Expertise !!![/font]</description><pubDate>Mon, 05 Jul 2010 04:46:24 GMT</pubDate><dc:creator>Abrar Ahmad_</dc:creator></item></channel></rss>