create table #testing(id int, name varchar(50))
go
Insert Into #testing
Values(231, 'fasd')
Insert Into #testing
Values(232, 'dsffd')
Insert Into #testing
Values(233, 'xas')
Insert Into #testing
Values(234, 'asdasd')
create table #testing2(id int, name varchar(50))
go
Insert Into #testing(id)
Values(231)
Insert Into #testing(id)
Values(232)
Insert Into #testing(id)
Values(233)
Insert Into #testing(id)
Values(234)
go
update m
set name = x.name
from #testing2 m
join #testing x
on m.id = x.id
Where m.name is null
#testing 和 #testing2 上没有索引
#testing 和 #testing2 上 id 列的索引
指数是
create nonclustered index ix_test1 on #testing1(id) include (name)
create nonclustered index ix_test1 on #testing2(id)
在这种情况下,最好的索引是什么?#testing(name) 上没有索引是否正确,因为写入/更新会更慢?