2017-09-28 7 views
-2

コードを書き換えるより良い方法はありますか?クエリは永遠に実行されます。ありがとうございましたどのようにタイムアウトしているこのSQLクエリをスピードアップできますか?

SELECT * from w..ts 
    where not si in 
    (
    select si from g..sa 
    ) 
    and ci in 
    (
    Select ClientID from w..tcwhere ds= 'AZ' 
    ) 
    and s> 2 
    and sd between '1/1/2010' and GETDATE() 
    order by si 
+4

ようこそ。 [ask]を読んでください。これは質問ではありません。何のDBプラットフォーム、どのような特定のエラー? – OldProgrammer

+0

これらの実際のWebサービスはありますか?これはあなたに有用な応答を与えるのに十分な情報ではありません。 –

+0

クエリが永遠に実行するコードを書き直す良い方法はありますか? – Alexo

答えて

1

結合を検討してかわりに適用してください。

SELECT * from webservice..tService 
left join table t1 on t1.col1 = tService.col2 
inner join table t2 on t2.col1 = tService.col2 
where t1.ServiceID is null 
and ServiceStep > 2 
and ServiceDate between '1/1/2010' and GETDATE() 
order by ServiceID 
関連する問題