Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WHERE IN syntax for Exist/Not Exist
Message
 
 
À
29/01/2017 17:03:00
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2014
OS:
Windows 8.1
Network:
Windows Server 2012
Divers
Thread ID:
01647092
Message ID:
01647145
Vues:
33
>>
>>I had a really big problem with some queries that were ran on MySQL (perhaps two years ago) and that IN clause just killed the process. It was a huge problem for the client and lots of frustration until the cause was found. Since then I prefer Exists to be on the good side. Is there a situation where IN() with subquery would absolutely give you a better result compared with Exists()? Then I would rethink my strategy.
>
>
>Question - are you saying your experiences with bad performance using IN were with the product MySQL?

Yes, it was specifically using a MySQL database. Of course as you were saying, many factors play a role. But we could reproduce this bad performance in different unrelated areas using MySQL with queries using IN, and both were solved with a dramatic performance increase replacing the IN with EXISTS. While working in MSSQL I have never tried using IN for subqueries, so I cannot say if that would have been the same. But from what you are saying I can imagine MSSQL handles those cases automatically and probably optimizes the query.
Christian Isberner
Software Consultant
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform