Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP SQL Efficient queries

Status
Not open for further replies.

NeeNee

Programmer
Apr 2, 2002
97
CA
I am creating a customer display page which displays information from various tables with multiple rows returned.

Is it more efficient to write multiple simple queries and query the database multiple time? Or write one complex query which queries the database once?



Denis
Programmer, Canada
 
Denis, this is really a question for one of the SQL forums. However I would recommend one query in the form of a stored procedure as this is more efficient.

Nick

where would we be without rhetorical questions...
 
I was unsure where to ask. This is also about efficient use of database connections and recordsets. If I use one query or stored procedure, I am returning many rows with duplicate data. But if I use many simple queries, I am only returning the required fields.



Denis
Programmer, Canada
 
Denis,
In my opinion--not knowing your data structure or page design--but I would write the complex queries in a stored procedure that returns a recordset of the combined data.

This recordset would build the html page. This way, the complex sql is performed on the server with one request, and the data is returned to the IIS server as a single recordset, then ASP builds the page which is returned to the client browser.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top