sql server - What is the best way to refresh a rollup table under load? -


I have created a table in my SQL Server 2005 database and presented it with summaries and calculated values. Its purpose is to connect the database on a wide range of calls and avoid the group. I would like this table to refresh every hour, but I'm not sure that the best way to do this while loading on the website is to do this. If I remove every record and re-apply the table in one transaction, then will it be a trick or deadlock and other problems?

postproc = text ">

The way I have done this in some projects, using two copies of the table in different schemas, something like this: Make a schema with the authorization dbo; make SCHEMA standby with authorization; Go table dbo.mySummary (& lt; ... column ... & gt;) Make table vs. MySummary (& Lt; ... column ... & gt;); Geo

Now create a stored procedure, which sorts the duplicate table and resets it again, then Objects are moved between the schemas in the denominator.

  CREATE PROCEDURE dbo. Start as SwapInSummary Incorporated on the op; Tocet table counterfeit. MySummary; INSERT fake.mySummary (& Lt; ... column ... & gt;) Choose & quot; Query Query & quot ;; BEGIN Transfer; ALTER SCHEMA Standby Transfer dbo.mySummary; Optional SCHEMA dbo transfer fake.mySummary; ALTER SCHEMA Fake transfer standby.mySummary; COMMIT TRANSACTION; GO  

This may be about the least time that you have a user Can wait for the new data to refresh and interrupt the readings (there are many issues related to the NOLOC which make it less desirable choices, although valid, it is easy to code. ) For summarizing / clarity I have left the handling of the error etc., and I should also inform that if you use the scripts to synchronize your database, Make sure you use the odds of names in both tables, indexes, etc., otherwise you will be out of sync half. At the end of the process you can erase new imitation. My tables, but if you have a place, then I want to leave the data there so I can always compare the previous version.

Before SQL Server 2005 I used to fill the same thing within the transaction within the span, but since I do this in the job, I have to switch to the schema. I was happy because when I did, non-suppressive warning from sp_rename was stopped filling out my SQL Server Agent History Log


Comments