如何提高简单sql查询的性能 请考虑下表中的字段
id, name, empId, address, contact, joiningDate, designation, location
select * from tblEmployee where location = "Amsterdam"
目前需要3秒,如何减少它。
请建议所有可能的解决方案或方法,以提高查询性能。
答案 0 :(得分:1)
您可以在location
列上创建索引。
CREATE INDEX ix_emp ON tblEmployee(location);
-- NONCLUSTERRED is default
-- please note that I've changed " to '
select * from tblEmployee where location = 'Amsterdam';