Re: Data Constraints Vs Application Constraints

From: Alexandr Savinov <savinov_at_host.com>
Date: Wed, 09 Mar 2005 14:58:22 +0100
Message-ID: <422f00ff$1_at_news.fhg.de>


Here are some reasons for having constraints and other procedures at the database level rather than at application level:

  • Transactions. It is the most important criterim. Database provides a scope for transactions while an application does not. If your code or constraints must be within one transaction then it has to be executed within the database (or some other environemnt maintaining transactionality). For example, if one field must be larger than another field in another table then there is no (easy) way to check it from application.
  • Code reuse. Some functionality is executed by many applications so it does make sense to move it to the database. If many different applications are going to use the same (type of) constraints then think about defining them in the databae.
  • Performance. The code in the database might execute faster.

alex

http://conceptoriented.com Received on Wed Mar 09 2005 - 14:58:22 CET

Original text of this message