Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A different approach for optimization
Message
De
02/03/2014 07:22:20
 
 
À
28/02/2014 14:56:10
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01595558
Message ID:
01595618
Vues:
35
Have you timed joining from a table already spelling out DISTINCT CONVERT(CHAR(4),YEAR(Invoice.ModDate)) ? Would need fitting index in invoice and perhaps a having clause to prune empty rows...

HTH

thomas

>I have a select like this:
>
>
>DECLARE @Success Bit
>
>SET @Success=1
>
>SELECT CONVERT(CHAR(4),YEAR(Invoice.ModDate)) AS lcChampNumero,COUNT(*) AS Compte,MIN(Invoice.ModDate) AS AddDate
> FROM Invoice (NOLOCK)
> INNER JOIN InvoiceStatus ON Invoice.NoInvoiceStatus=InvoiceStatus.Numero
> INNER JOIN Client ON Invoice.NoClient=Client.Numero
> WHERE (Invoice.Success=@Success) AND Invoice.NoSomething=2
> GROUP BY CONVERT(CHAR(4),YEAR(Invoice.ModDate))
> ORDER BY 1 DESC
>
>
>I am looking at an alternative to boost up performance here. In some occasions, this can be very long. There are indexes on every fields. However, this GROUP BY thing on a big table may take up to 10 to 50 seconds sometimes.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform