Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speed up SQL
Message
De
12/06/2013 11:35:12
Walter Meester
HoogkarspelPays-Bas
 
 
À
12/06/2013 11:24:22
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Desktop
Divers
Thread ID:
01576055
Message ID:
01576129
Vues:
38
>>>>>Thanks!
>>>>>
>>>>>I can't attach it here and neither can I post it even though I surround it with pre tags. :(
>>>>
>>>>Frank,
>>>>ZIP the .SQLPLAN and attach it as a file here.
>>>
>>>See attached.
>>
>>That looks like the estimated executionplan as its missing the actual numbers. Can you post the performed execution plan?
>>
>>Can you also execute it with the RECOMPILE option? Depending on the parameters passed it might reuse an execution plan that is optimal for one value, but not for another.
>>
>>
>>Walter,
>
>I've attached the Actual Execution Plan.
>
>Will research the RECOMPILE option and try it out.

Yes, this shows the problem. There is simply too much I/O going on. Too many rows being retrieved from the database.

I suspect the problem is in the NOT IN(), in combination with the UNIONs in the subquery.
I'd try to rewrite the query to use
WHERE NOT EXISTS (SELECT 1 FROM CashReceipts INNER JOIN Deposits on crt_depfk = dep_pk AND  crt_invfk = ivd_invfk)  
AND NOT EXISTS (SELECT 1 FROM receiptdetailszipx INNER JOIN Receipts ON rdz_rctfk = rct_pk AND rdz_invfk = ivd_invfk) 
AND NOT EXISTS (SELECT 1 FROM ...) 
AND NOT EXISTS (SELECT 1 FROM ...)
Walter,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform