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!

SQL performing question

Status
Not open for further replies.

HaveTrouble

Programmer
Jan 10, 2005
63
0
0
US
I want to pull a report that will join multiple tables (around 4 tables. some from same database and some from different databases) and perform some simple calculation such as field A * field B. Say there are 50,000 entries in the main table. Which way is the most efficient way to pull report from ASP ? Should I just add the fields I need into the main table or create a view for it ? My main goal is not to stress out SQL server and achieve the maximum result. Any suggestion ?
 
If it was me I would create a stored procedure then have the ASP call the stored procedure.

Here we go Royals! Here we go!!!!!
 
Stored procedure still needs to have queries in it to pull data, right ? My question is: is it more efficient to create a view so the query will be like "select field1, field2,... from view1 where..." or more efficient to select from base table and join tables I need if there are 50,000 in one of my tables ?
 
View does not physically store any data so when you run the view, it runs the precompiled query which is the same as running the query.

On the other hand if you want to create indexed view then yes you will have some performance benefit.

Read this tutorial on indexed views and see if thats what you are after.

Regards,
AA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top