网络编程
位置:首页>> 网络编程>> 数据库>> 教你快速掌握数据库查询优化的实用技巧(3)

教你快速掌握数据库查询优化的实用技巧(3)

作者:33893 来源:赛迪网 发布时间:2008-11-28 15:10:00 

标签:

从字段Title和Author中模糊检索,按Id排序

查询时间:2 - 2.5秒

方案3:

主键Id,默认为聚集索引

在Title、Author、Star上建立非聚集索引

select * from News where Title like '"&abigale&"%'
or Author like '"&abigale&"%' order by Star desc
 
从字段Title和Author中模糊检索,按Star排序

查询时间:2 秒

方案4:

主键Id,默认为聚集索引

在Title、Author、Star上建立非聚集索引
select * from News where Title like '"&abigale&"%' or Author like '"&abigale&"%'
 
从字段Title和Author中模糊检索,不排序查询时间:1.8 - 2 秒

方案5:

主键Id,默认为聚集索引

在Title、Author、Star上建立非聚集索引

select * from News where Title like '"&abigale&"%'

select * from News where Author like '"&abigale&"%'
 
从字段Title 或 Author中检索,不排序查询时间:1秒

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com