We have a bunch of queries over a time series which were taking over 1 minute to process. The Fact table contains just over 4m rows. Adding a new index on Date and CompanyKey and including the columns being summed resulted in the slowest query now running in 3s. However, we have some queries left over which group on country (fact table joins to DimCompany on CompanyKey).
If I remove the group by, the query runs in a few seconds. I realise the select distinct also slows things down, but I have ideas for that. I'm more focused on the group by performance at this point.
By Clive 1 asked Jun 15 at 12:35 PM