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 |
jdelgado
Starting Member
5 Posts |
Posted - 2010-08-16 : 10:12:05
|
Hi,I have an application with where we are logging process data from different machines at a rate every 6 secs. So every 6 secs a record is logged from a machine and there are 8 machines. This is use on a report for trending. The application has been running for 3 years we have a total of 28,570,112 records the application is timing out and it is taken around 40 secs to get the data when I manually run the query. I am getting the data from a stored procedure which calls a view where I join two tables. I filter the data by the ProcsId field. Is 40 secs to much ? The table design are the following are my keys selection good should I do anything different on the designed. I had reindex the table and updates the stats. Should I ad an Index to the view. Trend TabledtTimeStamp datetime (PK)ProcsId varchar(16)(PK, FK)SegId tinyintPhaseId tinyint (FK)SegTime smallintSVTemp smallintSVTemp2 smallintSVPress smallintSVLvl smallintPVTemp smallintPVTemp2 smallintCircTemp smallintPVPress smallintPVLvl smallintRotrSpd smallintRotrPos smallintFlow smallintPhase is the other table I join in the viewPhaseId tinyint (PK)PhaseDesc varchar(50)PhaseDescEsp varchar(50)ProcsMode tinyintPhaseEnabled tinyint |
|
MichaelHLutz
Starting Member
19 Posts |
Posted - 2010-08-18 : 21:25:11
|
Sounds like you are summarizing the data in your report. A better performing solution if this is feasible is to store the summarized historical data in another table by ProcsId and then only query the more recent data from your Trend Table each time the report runs, and append that data to the pre-summarized data. Then you could delete out the old data as well if this reporting is the only purpose of the data. In other words, pre-summarize (pre-aggregate) the data only once and use it as opposed to using the raw data. It will take some work but then hopefully your reports will run lightening quick, not to mention disk space savings.Make sense? |
|
|
|
|
|