Wednesday, March 21, 2012

no bookmark lookup noticed when i think i need to see it

SELECT t2.col1 FROM Table1 t1 JOIN table2 t2 on t1.col2=t2.col2 and
t1.col3=t2.col3 returns 20 rows...
It is doing a nested loop join with t1 being the outer table and t2 being
the inner table. it is doing a non clustered index seek on t2. The
nonclustered index it is using is on (col2,col3). What I dont understand is
why on my execution plan I dont see a bookmark lookup to fetch the
corresponding row since i need t2.col1
When i run
SELECT t2.* FROM Table1 t1 JOIN table2 t2 on t1.col2=t2.col2 and
t1.col3=t2.col3
I see a bookmark lookup with the same indexes being used as the previous
query for the 2 tables...Perhaps you have a clustered index on t2(col1)? Remember that the nc indexes uses the clustering key
as row locator.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as ugroup=microsoft.public.sqlserver
"Hassan" <fatima_ja@.hotmail.com> wrote in message news:OTXLtMWiDHA.1456@.TK2MSFTNGP11.phx.gbl...
> SELECT t2.col1 FROM Table1 t1 JOIN table2 t2 on t1.col2=t2.col2 and
> t1.col3=t2.col3 returns 20 rows...
> It is doing a nested loop join with t1 being the outer table and t2 being
> the inner table. it is doing a non clustered index seek on t2. The
> nonclustered index it is using is on (col2,col3). What I dont understand is
> why on my execution plan I dont see a bookmark lookup to fetch the
> corresponding row since i need t2.col1
> When i run
> SELECT t2.* FROM Table1 t1 JOIN table2 t2 on t1.col2=t2.col2 and
> t1.col3=t2.col3
> I see a bookmark lookup with the same indexes being used as the previous
> query for the 2 tables...
>sql

No comments:

Post a Comment