Skip to content

Instantly share code, notes, and snippets.

@alliwallibobali
Last active August 17, 2021 21:37
Show Gist options
  • Save alliwallibobali/ce94e8767417c37aa34b40faf416ced4 to your computer and use it in GitHub Desktop.
Save alliwallibobali/ce94e8767417c37aa34b40faf416ced4 to your computer and use it in GitHub Desktop.
One of the most common questions application developers ask is, “Why does my query run quickly sometimes and slowly at other times?” Consider the following stored procedure:
CREATE OR ALTER PROCEDURE SalesDemo (@ProductID INT)
AS
SELECT ProductID, Sum(LineTotal) as TotalSales from Sales.SalesOrderDetail
WHERE ProductID = @ProductID
GROUP BY ProductID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment