I have a query that takes 1.5 minutes to run (depending on how much data is returned in the query) and I want to performance tune the database for the query.
I have run the "Display Estimated Execution Plan" in SQL Server Management studio and added all the keys suggested.
Now I am adding indexes for any of the fields used in the where clauses and JOIN clauses.
The Client.ClientId is already a primary Index.
There is a PK Key and a PK Index on that field (for all my tables same idea).
But other tables: For instance if it says:
INNER JOIN Client on Client.ClientId = Employee.ClientId
I created an Index on the Employee table, ClientId.
So anything used in a where clause I add another index on that column.
Is that right? Any other ideas?