如果我的表Mission
具有以下结构:
emp_num int P.K
from_date datetime P.K
to_date datetime P.K
mission_location varchar(200)
mission_desc varchar(200)
req_ser int P.K
req_year int P.K
CONSTRAINT [pkc_mission] PRIMARY KEY CLUSTERED
(
[emp_num] ASC,
[from_date] ASC,
[to_date] ASC,
[ req_ser] ASC,
[ req_year] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
当我尝试运行此查询时:
select *
from mission where emp_num =5307
它工作得非常快,但是当我尝试用另一个值运行相同的查询时,它需要永远!
select *
from mission where emp_num =4595
答案 0 :(得分:1)
请试试这个 -
select *
from mission with (forceseek)
where emp_num = 4595