Question: Stored Procedures or Views?

From: Hokeyboy25 <hokeyboy25_at_aol.com>
Date: 2000/04/10
Message-ID: <20000410145030.23934.00001677_at_ng-md1.aol.com>#1/1


Hello.

I am new to SQL Server and I have a question.

Currently, we are using stored procedures to retrieve data for reports. These procedures are often run hundreds or thousands of times in succession, and are sucking up a lot of procesing time.

These procedures involve multiple MIN and SUMs, with about three JOINs per procedure.

It was brought up that the creation of a new table might speed up our report generation. This table would contain the calculated values produced by the SUM commands. Thus, instead of SUMming a group of values, we would do a a SELECT based on a unique ID.

My first question is: would a simple SELECT be faster or more efficient than a SUM within a stored procedure?

My second question deals with views: I believe that a view containing the same calculated SUM values as columns might be faster or more efficient. Would this be so? (I found it to be so in DB2, but....) Would the view column calculations run every time the view is accessed, or only when the view is created?

Thanks very much for your time; I can be emailed at this address but I will check the newsgroup throughout the day.

  • Matt
Received on Mon Apr 10 2000 - 00:00:00 CEST

Original text of this message