Databases Reference
In-Depth Information
are only models and estimations), as the actual number of records is only known when
the plan is executed and the results returned.
Finally, since non-clustered indexes can exist on both heaps and clustered indexes, we can
also have a bookmark lookup on a heap. To follow the next example, create an index on
the
DatabaseLog
table, which is a heap, by running the following statement:
CREATE
INDEX
IX_Object
ON
DatabaseLog
(
Object
)
Listing 2-12.
Then run the following query, which will produce the plan in Figure 2-11:
SELECT
*
FROM
DatabaseLog
WHERE
Object
=
'City'
Listing 2-13.
Figure 2-11:
A RID Lookup.
Note that, instead of the Key Lookup operator shown before, this plan displays a RID
Lookup operator. This is because heaps do not have clustering keys like clustered indexes
do, and instead they have row identifiers (RID). A RID is a row locator that includes
information like the database file, page, and slot numbers to allow a specific record to be