Re: Data Constraints AND Application Constraints

From: David Cressey <david.cressey_at_earthlink.net>
Date: Thu, 17 Mar 2005 12:14:31 GMT
Message-ID: <Hwe_d.9620$qf2.2831_at_newsread2.news.atl.earthlink.net>


"FrankHamersley" <FrankHamersleyZat_at_hotmail.com> wrote in message news:WId_d.1485$C7.1054_at_news-server.bigpond.net.au...
> Now that the "vs" thread has subsided I got to wondering how many
> practitioners of database constraints as a key element of schema designs
> consider there remains a need for further constraint (related) checking
> in the application code itself?

Absolutely, yes. Let's say that a certain field in a data entry form has to have a number in the range 20,000 to 99,000, and may not be left blank.

There are several reasons to check this in the application code, or in the forms subsystem if possible. The first is immediacy. There's no reason to force the user to wait for a round trip to the DBMS to find out that his entry is wrong, in this case. The second is decentralizing the load. The DBMS can better use its resources if it doesn't get distracted by this stuff.

The one place where I don't think the application should perform its own check is referential integrity. The cost is too high for the benefits. Keeping the reference table synchronized across multiple applications is a nightmare. Letting the DBMS do the check is easy. Received on Thu Mar 17 2005 - 13:14:31 CET

Original text of this message