Why is execution plan important in SQL Server?
Execution plans are a very important tool for optimizing query performance. Every DBA needs to know all operators that appear in the execution plan and decide whether it is good or bad and what to do if it is the latter. I tried to be simple in discussing the very basic details about the operators related only to clustered index.
Why is SQL Server not using my index?
OK – as long as you select only the column that’s in the index, or something from the clustering key (usually, this is the primary key), then the index will be used, since SQL Server can find all the information it needs (the UserTask_IDEntitat column, and the clustered index column (s) ) in the leaf level of the index navigation structure.
When to use Index on usertask Identitat?
CONSTRAINT [PK_UserTask] PRIMARY KEY CLUSTERED ( [UserTask_ID] ASC ) ON [PRIMARY] ) ON [PRIMARY] Executing the following query, execution plan shows us that index on UserTask_IDEntitat is used to do the query:
How does clustered index seek work in SQL Server?
If I move to the execution plan, you can see the Clustered Index Scan which was in the previous case has been transformed into a Clustered Index Seek, hence SQL Server was able to narrow down, using the clustered index key, to obtain this particular value based on the where condition, which is in the seek predicate
Can a PK be a non unique clustered index?
If not unique then it cannot be a PK, but can still be a non-unique Clustered Index. Then your non-clustered index would be only on the measure column. And, considering that the first field in the GROUP BY is also measure, that would also benefit from having measure be the leading field.
Is it good to use PK on table?
No PK on table, as it is a data warehouse. Index seek might not be the best choice if you return many rows and/or the rows are very wide. Lookups can be expensive if your index is not covering.