怎么提高sql语句的查询速度
如何提高sql语句的查询速度
String str= "select top 80 ID as 序列号, projectname as 项目名,range25 as 25幅度,range50 as 50幅度, ";
str=str+ "low1700 as 1700低频,middle1700 as 1700中心频率, range1700 as 1700中心频率幅度, ";
str=str+ "low2000 as 2000低频,middle2000 as 2000中心频率, range2000 as 2000中心频率幅度, ";
str=str+ "low2300 as 2300低频,middle2300 as 2300中心频率, range2300 as 2300中心频率幅度, ";
str=str+ "low2600 as 2600低频,middle2600 as 2600中心频率, range2600 as 2600中心频率幅度 "; // "2600中心频率幅度 " 与” "; “之间应该有一个空格 否则出错
str=str+ "from error where projectname <> ' "+ss+ " ' and ID> 100 ";
ID 为 主键 和索引 projectname 索引
用的是 ADOQUER 查询
ACCESS 没有存储过程 如何提高呀
------解决方案--------------------
统计总数的话,就用你写的就行了,你的不涉及多表,多条件查询,在SQL语句上没什么可优化的了。
------解决方案--------------------
同意楼上的意见
------解决方案--------------------
就这个sql而言,加索引“projectname,ID”就可以了
String str= "select top 80 ID as 序列号, projectname as 项目名,range25 as 25幅度,range50 as 50幅度, ";
str=str+ "low1700 as 1700低频,middle1700 as 1700中心频率, range1700 as 1700中心频率幅度, ";
str=str+ "low2000 as 2000低频,middle2000 as 2000中心频率, range2000 as 2000中心频率幅度, ";
str=str+ "low2300 as 2300低频,middle2300 as 2300中心频率, range2300 as 2300中心频率幅度, ";
str=str+ "low2600 as 2600低频,middle2600 as 2600中心频率, range2600 as 2600中心频率幅度 "; // "2600中心频率幅度 " 与” "; “之间应该有一个空格 否则出错
str=str+ "from error where projectname <> ' "+ss+ " ' and ID> 100 ";
ID 为 主键 和索引 projectname 索引
用的是 ADOQUER 查询
ACCESS 没有存储过程 如何提高呀
------解决方案--------------------
统计总数的话,就用你写的就行了,你的不涉及多表,多条件查询,在SQL语句上没什么可优化的了。
------解决方案--------------------
同意楼上的意见
------解决方案--------------------
就这个sql而言,加索引“projectname,ID”就可以了