My server at work is very low on space, which we are currently working to resolve. However, we also have some quick deadlines coming up where we need to get this data in there asap.
Origin table: 1.5 billion rows Unpivotted table: will have 11x 1.5billion rows......~17 billion rows
Is there a way to unpivot the origin table and store that over the origin table at the same time? Normally, I would just store it as a new table and then drop the old table. However, in this case it is not an option. I already tried that and errored due to space limitations.
1条答案
按热度按时间rhfm7lfc1#
Given the limited space I'm not sure that doing it it chunks will meet "quick deadlines" and I would pursue adding a new filegroup and a new file to it using ALTER DATABASE ADD FILE. Then, create the unpivoted table using SELECT INTO and specify the new filegroup using the ON clause.
Obviously this can be broken into separate steps to suit, and handling both a backup table and the new table in the currently limited space may not be possible so you may want to delay overwriting "origin_table" until you have resolved the current lack of space. Until you have the origin_table rebuilt perhaps use the unpivoted_table in lieu.