indexing - Why is my Sql Server query plan using scans instead of seeks when joining data? -
comming mysql background i'm having difficulties understand what's wrong following setup.
i have 2 tables variable , dimension
both have primary key, variable furthermore has foreign key dimension named dimension_instance_1_uid
, on index created.
when execute query
select this_.name, dimensioni4_.name dbo.variable this_ inner join dbo.dimension_instance dimensioni4_ -- index hint nothing changes... -- (index(pk_dimension_instance)) on this_.dimension_instance_1_uid = dimensioni4_.uid
it seems if index isn't used seek
, scan
executed according execution plan. shows 2 index scan's instead of 1 index scan , 1 index seek.
i expect index seek because in case in dimension_instance
10 of 15k records match entries in variable
table.
can shed light in misunderstanding of how ms sql indexes work.
the query execution plan , query optimizer estimate better operation regarding data inside db , other variables: in case maybe thinks query less costly doing index scan instead of seek: may caused low row numbers
Comments
Post a Comment