1
为什么此查询不使用索引假脱机?
我问这个问题是为了更好地了解优化器的行为并了解索引假脱机的限制。假设我将1到10000之间的整数放入堆中: CREATE TABLE X_10000 (ID INT NOT NULL); truncate table X_10000; INSERT INTO X_10000 WITH (TABLOCK) SELECT TOP 10000 ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM master..spt_values t1 CROSS JOIN master..spt_values t2; 并强制嵌套循环加入MAXDOP 1: SELECT * FROM X_10000 a INNER JOIN X_10000 b ON a.ID = b.ID OPTION (LOOP JOIN, …