国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

在SQL2k降序索引上使用中bug

2024-07-21 02:10:54
字體:
來源:轉載
供稿:網友
解決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
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 张家界市| 丽水市| 永泰县| 寿光市| 宜良县| 新安县| 长汀县| 上林县| 黔江区| 玉山县| 仪陇县| 东丽区| 黔西县| 巩留县| 琼中| 太保市| 墨竹工卡县| 牡丹江市| 盐亭县| 喜德县| 宁强县| 河曲县| 施甸县| 呼玛县| 星座| 西充县| 定安县| 定兴县| 上虞市| 美姑县| 会宁县| 遂宁市| 叶城县| 玉山县| 莒南县| 公主岭市| 陵水| 安溪县| 滦南县| 鹤峰县| 白河县|