Showing posts with label reviewing. Show all posts
Showing posts with label reviewing. Show all posts

Sunday, February 19, 2012

execution plan question

I'm new to sql server 2005 and was reviewing the execution plan on one of my queries.

I have a query that selects about 62,000 rows from a table of about 20 million

I see there is a index seek indicated but further down the execution plan I see that a large percent is being assigned to a RID LOOKUP on the same table.

Should I be concerned with this and if so, what would you recommend I do to correct it?

Indexes are like sorted miniature tables. They contain the indexed columns, any included columns, and lastly the primary key (or the internal row ID if a primary key does not exist).

If you see a lot of time lost to RID lookups, you have two options to correct it:

1) Change the clustered index to cover the column(s) that's being seeked upon. If the table has a primary key, the clustered index is created on it by default.

2) Modify your index to "include" the other columns needed by the query. If you're using SELECT *, change the * to a column list.

-Ryan / Kardax