在SQL2k降序索引上使用中bug
解决SQL2k降序索引上使用对比条件更新或删除的bug我在SQL server 2000 enterprise 和 personal 都试过了, 每次都这样。:(详细情况看我的回贴:SQl server 7.0 中的确没有问题,;;sql 2000 中(enterprise 和 personal版本都可以),表要有聚簇索引,并且索引的顺序是降序, 例如 按下列DDL sql 建立的表 CREATE TABLE [AType] (;;;;[AID] [int] NOT NULL ,;;;;[name] [varchar(20)] NOT NULL ,;;;;CONSTRAINT [PK_DateType] PRIMARY KEY;;CLUSTERED ;;;;([AID] DESC);;ON [PRIMARY] ,) ON [PRIMARY]添一些数据后, AID 分别分布在1-100之间INSERT INTO [AType] VALUES(1,'a')INSERT INTO [AType] VALUES(50,'b')INSERT INTO [AType] VALUES(100,'c')做;;;select from atype where Aid < 50 ;;;go ;;;delete from Atype where AID < 50 ;;;go ;;;select from atype where Aid < 50 最后一句查询仍然有记录输出. :(by 怡红公子报告已经发送给MSSQL开发小组,他们承认这一错误。在没有新的补丁出来之前,给出以下建议:不要在单列上使用降序索引,因为这并没有在性能上带来好处,仅仅是省略了Order by field desc几个字而已,用qa的show plan看一下就知道了,不管有没有order by或者不管是asc还是desc,都没有这项开销的(在聚簇索引上)。降序索引一般是用于复合索引的,这可能是这个bug出现的原因。原文:Note that there is no need to create a descending index on a single column because SQL Server can traverse an ascending index backwards when appropriate.;;Descending is normally used only in composite indexes.;;This is probably why the bug surfaces here
上一条:分布式查询和分布式事务下一条:如何将图片存到数据库中?
相关文章:
热门推荐
- Solaris如何增加用户?(groupadd,useradd)
- 1.FreeBSD Apache+Mysql+Php4的安装
- 2.Linux系统下http服务不能解释php的问题
- 3.配合QMAIL邮件系统:SOLARIS + HTTPD + MYSQL + PHP + LIMITIP
- 4.Linux命令Man解释:groupadd :建立新组
- 5.abcache php加速
- 6.ie6不兼容hover ie6 a hover属性失效解决办法
- 7.如何在FreeBSD上用PHP实现在线添加FTP用户
- 8.Linux系统中自带Mysql、Apache、Php卸载
- 9.Solaris 10整合apache与php过程及出错处理
- 10.Vista下玩转php开发 IIS7下安装配置php实战指南