Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A different approach for optimization
Message
From
02/03/2014 07:22:20
 
 
To
28/02/2014 14:56:10
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01595558
Message ID:
01595618
Views:
34
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform