Hi,I am performing some index tuning at a simple query. Assume there is a table called "Sales" where saves information of sales. See:CREATE TABLE Sales(product_name VARCHAR(15) NOT NULL REFERENCES Products (product_name), product_price DECIMAL(5,2) NOT NULL, qty INTEGER NOT NULL, sales_year INTEGER NOT NULL);GO
And I have a SELECT statement like this:SELECT product_name, SUM(qty * product_price) AS year1 FROM Sales WHERE sales_year = 1990 GROUP BY product_name;
I think a useful index suggestion on the query is:CREATE NONCLUSTERED INDEX IX_0 ON Sales (sales_year) INCLUDE (product_name, qty, product_price)But I am not completely sure. What index will be efficient for this? And Is a CLUSTERED index on the table necessary? (The table has not the primary key)