home navigator pointer resources navigator pointer asp tips navigator pointer sql searching
The definitive ASP tips page
tips menu | printable single page version

Note: this is my old ASP tips page and is no longer supported. See the new Visualize web site..

ASP Coding for Performance - Use SQL for Searching Databases

Although this appears an obvious one, I still see the odd ASP script around which uses ASP loops to search through ADO recordsets for a particular record(s) to display, when really the SQL query should have done the searching. Avoid looping through recordsets for searching purposes, unless there is a specific reason to do so.

Worse still, avoid requerying databases inside ASP loops to carry out look-up operations. These have a high overhead and 9 times out of ten, are often not required. It's much better to make appropriate use of SQL inner/outer joins, even correlated sub-queries if necessary etc., to carry out such searches efficiently at the database engine level (that's what databases are good at!), leaving the ASP to control final displaying of the results.

 

DISCLAIMER: Note these pages are a free resource for anyone wishing to reference them. Although every care is taken to ensure their correctness, the author takes no responsibility for any errors or problems that may occur through their use, or indeed misuse. These pages are copyight of Dave Clarke, Visualize Software Ltd 1997-2000 (all rights reserved).


 


© Copyright Dave Clarke, 1996-2010