vineet_dubey1975 (2/7/2014)
I am serving data to the end user(WebPage) via table 'ATABLE'. The data in the table got refreshed after every 1 hr. through a SQL Job (Truncate and refill)The issue is while i truncate and refill the table take some time approx.3 min.During that time end user gets page empty data.
How can i fix this ? Is there any technique / Trick i can limit this time.Either put some type of lock on table or replication etc.
Please suggest and help.
Thanks
vD
don't truncate; insert into a new table instead; that might take your three minutes of ETL time; then you can drop the original table, and rename the new table to the correct table; that will take something like three or six milliseconds, and you'd be back up and running much faster.
here's some peudocode to visualize it
--CREATE THE staging table:
SELECT *
INTO ATABLE_Staging
FROM ATABLE
WHERE 1=2 --just the schema/no data
INSERT INTO ATABLE_Staging
--ETL Process inserts it's data here each hour.
SELECT ColumnList From OtherSources
DROP TABLE ATABLE
EXEC sp_rename 'dbo.ATABLE_Staging','ATABLE'
Lowell