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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Is this what a view is for?

Author  Topic 

gllen
Starting Member

7 Posts

Posted - 2006-03-31 : 20:15:28
I've never worked with views before though I have a vaugue idea what they're for :)

I have a table that is quite large and growing fast and my primary use for the data is to run lots of aggregate functions on it.
See my previous post for an example:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=63748

Queries like that are taking 10 seconds to run.

So what I'm looking for is a way to store the results of a query like that, run the actual query maybe once an hour, and any time a user needs that data they get the results of the last run.

My first thought was to just have "summary" tables that get updated by a Stored Procudure that runs on a schedule under "Jobs". Is there a better way?

Thanks!

Edit: Some of the "summary" data would be based on date, so the summarized data would only need to be processed once. Don't know if that is something to consider.

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-04-01 : 01:40:39
you can create a temp table, and then create a job, and run after a specific time, and inserted your summary data in the temp table. and when user demands for reports then you can pick up the value from that table.. and generate the reports.

These just a idea, since you will be in the better state to understand the issue.

hope this helps

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-04-01 : 06:53:50
I wouldn't use a temporary table for that for a few reasons.
1. It isn't temporary, you want it to be available all the time. If the server restarts, your table won't be there until the next job.
2. Unless it's a global temp table, it won't be available to most users.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page
   

- Advertisement -