Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Slow data retrieval
Message
 
 
À
18/07/2008 05:06:55
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01332178
Message ID:
01332184
Vues:
8
This message has been marked as the solution to the initial question of the thread.
It seems that you're overusing LEFT OUTER JOINs. Do you really need all of them to be such?
All JOIN expressions are incorrect. SQL Server does not have compound indexes so they cannot be optimized. The join should be on each column separately
INNER JOIN dbo.sal_dtl AS d 
 	ON m.f_year + m.type_code + m.sal_no = d.f_year + d.type_code + d.sal_no 

-- should be

INNER JOIN dbo.sal_dtl AS d 
 	ON m.f_year = d.f_year AND m.type_code = d.type_code AND m.sal_no = d.sal_no 

-- and so on
I also would recommend to reformat the query for readability.

>The result is OK, but data retrieval is very slow It takes 22 secs for 6,200 rows.
>Can this query be optimized?
>
<snip>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform