1
我在datawarehouse星型模式中有一個巨大的(3,000,000,000行)事實表。該表是按日期鍵分區的。如何在大型SQL表上創建新索引
我想添加一個索引的外鍵之一。這是爲了讓我能夠識別和刪除大型維度表中的無子行。
如果我只是發出一條CREATE INDEX語句,那麼它會花費很長時間。
是否有任何SQL大師有這個問題的任何奇特的技術?
(SQL 2008)
--Simplified example...
CREATE TABLE FactRisk
(
DateId int not null,
TradeId int not null,
Amount decimal not null
)
--I want to create this index, but the straightforward way will take forever...
CREATE NONCLUSTERED INDEX IX_FactRisk_TradeId on FactRisk (TradeId)
它是一張大桌子,所以它總是需要很長時間 - 我認爲最好的你可以真正希望的是桌子在創建索引時仍然有效。 – Justin