Re: Slow data entry form
- From: "onedaywhen" <jamiecollins@xxxxxxxxxx>
- Date: 27 Sep 2006 02:29:26 -0700
Lorien2733 wrote:
My code may
not be elegant but it works. The problem is that the history file is now over
70000 records and it takes a full five seconds to do the validation for each
record. This lag time is a real pain for my users.
Any ideas for speeding this thing up?
Here's an alternative approach:
1) Create database constraints (PRIMARY KEY, UNIQUE, validation
rule/CHECK, etc) with meaningful names to prevent invalid data from
entering the database. You should of course have such constraints in
place anyhow (see
http://www.dbazine.com/ofinterest/oi-articles/celko25).
2) Attempt to enter data into the database (possibly using a
transaction to be able to rollback partial operations etc).
3) Handle any error, using the meaningful constraint name contained in
the error description to determine the nature of the failure.
The idea is that a database round trip would be faster than your
existing five second front end validation code.
For example, rather than querying the database to determine whether the
forthcoming INSERT *would* fall foul of the PRIMARY KEY, instead try
the INSERT to see if it *does* fall foul of the PRIMARY KEY.
Jamie.
--
.
- References:
- Slow data entry form
- From: Lorien2733
- Slow data entry form
- Prev by Date: Using mysql UPDATE query with LIMIT
- Next by Date: strange table behavior
- Previous by thread: Slow data entry form
- Next by thread: Re: me.dirty
- Index(es):
Relevant Pages
|