問題描述
對于數百萬條記錄,哪個更快:永久表或臨時表?
Which is faster for millions of records: Permanent Table or Temp Tables?
我只需要將它用于 1500 萬條記錄.處理完成后,我們刪除這些記錄.
I have to use it only for 15 million records. After processing is complete, we delete these records.
推薦答案
在您的情況下,我們使用稱為臨時表的永久表.這是大型導入的常用方法.事實上,我們通常使用兩個臨時表,一個包含原始數據,一個包含清理過的數據,這使得研究提要問題變得更加容易(它們幾乎總是我們的客戶發現向我們發送垃圾數??據的新方式和不同方式的結果,但是我們必須能夠證明這一點).此外,您還可以避免諸如必須增加臨時數據庫或給想要使用臨時數據庫但必須等待它為您增長的其他用戶帶來問題等問題.
In your situation we use a permanent table called a staging table. This is a common method with large imports. In fact we generally use two staging tables one with the raw data and one with the cleaned up data which makes researching issues with the feed easier (they are almost always a result of new and varied ways our clients find to send us junk data, but we have to be able to prove that). Plus you avoid issues like having to grow temp db or causing issues for other users who want to use temp db but have to wait while it grows for you, etc.
您也可以使用 SSIS 并跳過暫存表,但我發現無需重新加載 50,000,000 表即可返回和研究的能力非常有用.
You can also use SSIS and skip the staging table(s), but I find the ability to go back and research without having to reload a 50,000,000 table is very helpful.
這篇關于表與臨時表性能的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!