网络编程
位置:首页>> 网络编程>> 数据库>> SQL Server数据库查询优化的常用方法总结(3)

SQL Server数据库查询优化的常用方法总结(3)

作者:罗丽娜  发布时间:2008-12-10 14:43: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