且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Key Lookup和RID Lookup之间有什么区别?

更新时间:2023-11-11 21:16:40

1。在表中查询NonClustered Column时会发生Key Lookup。首先,使用列查询的数据进行搜索时会发生索引查找。它将结果作为主键索引。它将主键传递给Key查找以快速检索数据以获取查询的列。



2.主要发生在没有任何过滤条件的查询中。 RID Lookup是使用提供的行标识符(RID)在堆上进行书签查找。它主要与嵌套查找相关联。



3.我没有得到它?请清楚解释!!!
1. Key Lookup happens when you are querying NonClustered Column in the table. First, Index seek will happen for searching with data you queried with column. It will gives result as a Primary key Indexed. It passes Primary key to Key lookup to retrive data as fast to get the queried columns.

2. It mostly happens with queries who doesn't have any conditions to filter. RID Lookup is a bookmark lookup on a heap using a supplied row identifier (RID). It mostly associate with nested lookups.

3. I didn't got it ? Please explain it clearly !!!