Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sanj
Starting Member
22 Posts |
Posted - 2009-01-04 : 08:40:25
|
| Hi,I have a query that is used on several pages on a site (same query), would it be more effecient to create a Indexed view of this rather than query the database on each page?Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-04 : 12:43:09
|
| why not make it a procedure/function and call it everywhere you need. |
 |
|
|
sanj
Starting Member
22 Posts |
Posted - 2009-01-04 : 17:20:12
|
| Thanks for the suggestion I will try this. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
sanj
Starting Member
22 Posts |
Posted - 2009-01-04 : 17:40:41
|
| Thanks ref indexed views - what sort of performance over a query would I get from stored proc ? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2009-01-04 : 18:16:51
|
| We can't calculate what kind of boost you'd get by using a stored procedure. Prepared statements from an application can be just as fast as a stored procedure. You'll need to do some load testing to determine what works for you.If I have a say about the data access, I demand that stored procedures be used. However I don't always have a say, so I've got several applications in production that do not use stored procedures but luckily most of those use prepared statements.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
|
sanj
Starting Member
22 Posts |
Posted - 2009-01-04 : 19:08:44
|
| Thanks Tara,I'm not too sure the difference between a Prepared statement, stored procedure are there any advantages/dis-advantages?to be more specific most of the queries on my app return the same information, with some pages that filter this information on the ID (primary key) |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|