自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

加快數(shù)據(jù)倉庫加載無需添加硬件的解決方法

數(shù)據(jù)庫 數(shù)據(jù)倉庫
本文說到的是加快數(shù)據(jù)倉庫加載速度的方法,由于硬件環(huán)境無法改變,作者只能從倉庫設(shè)計和加載細節(jié)入手來改變了。

很多公司流行使用數(shù)據(jù)倉庫進行數(shù)據(jù)分析,一般從線上數(shù)據(jù)源備庫(mirror,logshipping,slave等)抽取到ods 層

在從ods層到dw再到dm.特別在ods層到dw時,數(shù)據(jù)的清洗裝載需要一定的時間和硬件資源.

但是當硬件成為瓶頸時,怎么能快速完成清洗轉(zhuǎn)載,及時的提供數(shù)據(jù)分析?

下面提供一種方法使用Ssis 加載到 ods層后,直接通過分區(qū)表把數(shù)據(jù)加載到 dw 

1 準備

  1.  /*create filegroup*/  
  2.   ALTER DATABASE [testxwj] ADD FILEGROUP [account_1]   
  3.  go   
  4. ALTER DATABASE [testxwj] ADD FILEGROUP [account_2]   
  5. go   
  6. ALTER DATABASE [testxwj] ADD FILEGROUP [account_3]  
  7.  
  8. /*create file to filegroup*/  
  9.  
  10. ALTER DATABASE [testxwj] ADD FILE ( NAME = N'account_1', FILENAME = N'E:\account_1.ndf' , SIZE = 409600KB , FILEGROWTH = 20480KB ) TO FILEGROUP [account_1]  
  11.   GO  
  12. ALTER DATABASE [testxwj] ADD FILE ( NAME = N'account_2', FILENAME = N'E:\account_2.ndf' , SIZE = 409600KB , FILEGROWTH = 20480KB ) TO FILEGROUP [account_2]  
  13.  GO  
  14. ALTER DATABASE [testxwj] ADD FILE ( NAME = N'account_3', FILENAME = N'E:\account_3.ndf' , SIZE = 409600KB , FILEGROWTH = 20480KB ) TO FILEGROUP [account_3]  
  15. GO16 

2 使用ssis copy table

  1. sp_spaceused accountdetail; 

  1. /* delete EarnTime is not null*/   
  2.  
  3. /*23 sec*/   
  4. delete from accountdetail where EarnTime is null 
  5. /*26 sec*/   
  6. delete from accountdetail where isnull(CommitStatus,0)<1   
  7. /*12 sec*/  
  8. delete from accountdetail where  isnull(EarnStatus,0) =0 

對傳輸過來的表進行分區(qū)

  1. /*create partition function*/  
  2. declare @bdate char(8),@edate varchar(8),@sql varchar(500)   
  3. select   
  4. @bdate=convert(char(8),GETDATE()-1 ,112)   
  5. ,@edate=convert(char(8),GETDATE() ,112)   
  6. select @bdate,@edate;  
  7. set @sql='   
  8. CREATE PARTITION FUNCTION ac_EarnTime (datetime)  
  9. AS11 RANGE RIGHT FOR VALUES ( '''+@bdate+''' ,'''+@edate+''')'  
  10.  execute(@sql)  
  11. /*create partition schema*/  
  12. CREATE PARTITION SCHEME ac_schema_ac_EarnTime
  13. AS PARTITION ac_EarnTime TO (account_1,account_2,account_3);  
  14. /*create partition table */  
  15. alter table accountdetail  
  16. alter column EarnTime datetime not null;  
  17. alter TABLE accountdetail  
  18. add CONSTRAINT [PK_PARTITIONmis] PRIMARY KEY 
  19. (   id,EarnTime
  20.  )ON ac_schema_ac_EarnTime(EarnTime)

把分區(qū)partition 2指向給 dw 值得注意的是 accountdetail_dw 必須跟partition 2 分區(qū)所在同一個文件組

  1. /*switch accountdetail to accountdetail_dwl*/  
  2.  ALTER TABLE accountdetail SWITCH PARTITION 2 TO accountdetail_dw ;  
  3. /**/ 

整個過程在 5分鐘內(nèi).數(shù)據(jù)倉庫最重要的還在當初的設(shè)計和選型.

原文標題:當硬件成為瓶頸時怎么提高數(shù)據(jù)倉庫的加載?

鏈接:http://www.cnblogs.com/xwj1985/archive/2010/08/19/1803272.html

【編輯推薦】

  1. 數(shù)據(jù)倉庫及其體系結(jié)構(gòu)建設(shè)
  2. 建立數(shù)據(jù)倉庫的八條基本準則
  3. 成功實施數(shù)據(jù)倉庫項目的七個步驟
  4. 動態(tài)數(shù)據(jù)倉庫設(shè)計與應用淺談
  5. 成功實施數(shù)據(jù)倉庫項目的七個步驟
責任編輯:彭凡 來源: 博客園
相關(guān)推薦

2011-05-13 14:17:27

智能數(shù)據(jù)倉庫

2021-09-01 10:03:44

數(shù)據(jù)倉庫云數(shù)據(jù)倉庫數(shù)據(jù)庫

2009-12-16 10:50:26

2022-08-01 11:30:27

數(shù)據(jù)建模

2023-01-11 10:29:26

2013-03-20 16:23:53

數(shù)據(jù)清洗

2022-07-28 13:47:30

云計算數(shù)據(jù)倉庫

2017-06-27 10:08:29

數(shù)據(jù)倉庫模型

2024-09-05 16:08:52

2009-01-18 15:48:31

數(shù)據(jù)倉庫數(shù)據(jù)存儲OLTP

2023-08-14 16:56:53

2024-03-19 13:45:27

數(shù)據(jù)倉庫數(shù)據(jù)湖大數(shù)據(jù)

2009-02-06 09:56:56

軟件測試數(shù)據(jù)倉庫測試開發(fā)與執(zhí)行

2025-03-12 03:00:00

2011-03-25 16:15:42

SQL Server

2023-11-23 16:59:37

數(shù)據(jù)倉庫建模

2024-06-12 13:46:41

2022-10-27 09:50:41

數(shù)據(jù)倉開發(fā)

2009-01-19 14:08:35

ODS數(shù)據(jù)倉庫粒度

2018-07-24 09:28:18

存儲數(shù)據(jù)倉庫
點贊
收藏

51CTO技術(shù)棧公眾號