Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A different approach for optimization
Message
From
28/02/2014 14:56:10
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
A different approach for optimization
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01595558
Message ID:
01595558
Views:
71
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.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform