In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.
SELECT CASE WHEN Locations.[Location Name] IS NULL THEN @Location ELSE Locations.[Location Name] END AS Location, Calendar.Dt, CASE WHEN Sales.[Net Sales] IS NULL THEN 0 ELSE Sales.[Net Sales] END AS CurrentSales, LEFT(DATENAME(dw, Calendar.Dt), 3) AS DayName, DATEPART(isowk, Calendar.Dt) AS WeekNum FROM Locations LEFT OUTER JOIN Sales ON Locations.LocationNameOrig = Sales.[Location Name] RIGHT OUTER JOIN Calendar ON Sales.Date = Calendar.Dt WHERE (Locations.[Location Name] = @Location) AND (Calendar.Dt BETWEEN @Begin AND @End) OR (Locations.[Location Name] IS NULL) AND (Calendar.Dt BETWEEN @Begin AND @End) ORDER BY Calendar.Dt
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.