What are heap based tables?
tables without a clustered index
What is a covering index?
an index that contains all the output columns for the operation performed on the index (So there is no strict definition of a covering index. Whether an index is “covering” or not is based on the query that used the index. More specifically, it is based on the output columns of the query that used the index)
Is a clustered index a covering index?
It can be considered a covering index since it contains all the columns in the table
What’s the difference between a table scan of an index based table (Clustered Index scan) and a table scan of a heap table?
Clustered index scan is faster than a table scan of a heap table because leaf nodes of the clustered index are stored together.
What steps do you take when optimizing a slow running query?
What do you look for in a query plan?
Why wouldn’t the query engine use an index seek over a clustered index scan?
Index seeks are generally faster than scans, but there might be a situation where an index is not “covering” which means it will need a bookmark lookup in addition to the index seek. Clustered indexes don’t require bookmark lookups since all the data are already stored on the leaf of the clustered index.
What’s a bookmark lookup?
Process of finding the actual data in the sql table.
This is done when the index used in the query is not “covering” - not all columns in the select are in the index
What can u do if a query’ use of an index always results in a bookmark lookup after?
UNCLUDE all columns in the query to the index to make it “covering”. Not necessarily part of the index. They can be just INCLUDED