我也跟風問個關於SQL的問題,請高人賜教。

來源: 2009-11-10 09:37:23 [博客] [舊帖] [給我悄悄話] 本文已被閱讀:

我常常要query幾個billion條記錄的datasets,每次都至少要45分鍾以上得到結果(remote) 。我昨天晚上用VPN聯上database,噩夢,用了差不多2個小時。我在想,可不可以優化一下我的code讓速度提高一點。比如說,

Proc sql;
Create table A as
Select ….
From DB1 inner join DB2 on a.keyword=b.keyword
Where controls;
Quit;

改成

Proc sql;
Create table A as
Select ……
From DB1 where controls and keyword in ( select keyword from B );
Quit;

這樣會不會快一點?各位高大還有沒有什麽優化的高招?在些多謝啦。

我用SAS/SQL,我想基本原理跟SQL是一樣的吧?