473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Northwind - execution plan bug? Why Index Seek and no Bookmark Lookup?

If you display the execution plan and run the following:

SET STATISTICS IO ON
go

SELECT ProductID, SupplierID
FROM Products
WHERE SupplierID = 1
I don't understand how come there is no
Bookmark Lookup operation happening to get the
ProductID?

I only see an Index Seek happening on SupplierID.
There is no composite index SupplierID + ProductID
so what am I not understanding here?

Thank you
Dec 10 '06 #1
3 2633
serge (se****@nospam.ehmail.com) writes:
SELECT ProductID, SupplierID
FROM Products
WHERE SupplierID = 1
I don't understand how come there is no
Bookmark Lookup operation happening to get the
ProductID?

I only see an Index Seek happening on SupplierID.
There is no composite index SupplierID + ProductID
so what am I not understanding here?
In a non-clustered index, there needs to be a row locator to get to
the data page. If the table does not have a clustered index, the row
locator is an internal record id. But if the table has a clustered index,
the row locator is simply the clustered index key. As a result of this,
the columns of the clustered index are present in the leaf node of
every non-clustered index.

And thus a query like the one above can be evaluated from the non-clustered
index alone.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Dec 10 '06 #2
To add to Erland's response, an index with leaf nodes that contain all
columns needed by a query is a 'covering' index. Besides the clustered
index key columns, one can add non -key columns in a SQL 2005 non-clustered
by specifying an INCLUDE column list in order to cover particular queries.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"serge" <se****@nospam.ehmail.comwrote in message
news:9n********************@wagner.videotron.net.. .
If you display the execution plan and run the following:

SET STATISTICS IO ON
go

SELECT ProductID, SupplierID
FROM Products
WHERE SupplierID = 1
I don't understand how come there is no
Bookmark Lookup operation happening to get the
ProductID?

I only see an Index Seek happening on SupplierID.
There is no composite index SupplierID + ProductID
so what am I not understanding here?

Thank you

Dec 10 '06 #3
Thanks Guys, it is much clearer now for me.
Dec 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: M Wells | last post by:
Hi All, I have a table that currently contains approx. 8 million records. I'm running a SELECT query against this table that in some circumstances is either very quick (ie results returned in...
1
by: Vinny | last post by:
Can anyone help me with this strange problem please? I have a stored procedure, with a parameter defined as a uniqueidentifier. The procedure does a select with a number of joins, and filters...
8
by: djwhisky | last post by:
Hi there - i'm hoping someone can help me! I'm having a problem with a live database that i'm running on MSDE - It seems to have slowed down quite considerably from the test environment (even...
6
by: tracy | last post by:
I have a complex query (16 table join) that until five days ago took 30 sec to run. It now takes eight hours. I restored a backup of the database from five days ago and the query plans are...
2
by: Ragu | last post by:
Hi Can you give me sone pointers to where I can get more information about the various operations like index seeks,Bookmark Lookups,Clustered Index Scan in an execution plan. Thanks Ragu
5
by: Krisnamourt Correia via SQLMonster.com | last post by:
I have one query that executes many times in a week. I created one Maintenances plan that Rebuild all index in my Database that has been executed at 23:40 Saturday until stop finished at Sunday. ...
6
by: talfano | last post by:
Hello, We are having a very strange problem. We have a table with about 5 million rows in it. The problem is with one of the non clustered indexes. I have noticed that sometimes in query...
5
by: Madhivanan | last post by:
The cost of query with usage of functions is as same as that of without functions In the below code, the query cost of insert is 0.02% and two select statements costs same 0.04% Declare @t...
1
by: Average Bear | last post by:
If anyone could help with this one, I am a bit puzzled. I understand you can create an index using two fields of a database, then use the seek method to find a record based on both fields. My...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.