--建hash value列
alter table TAB
add URLHash as checksum(URL);
go
--在hash value上创建clustered index
-- create a non-unqiue clustered index on the hashed column for collisions.
create clustered index IX_URLHash
on TAB(URLHash);
go
--查询处理
select customerId
from TAB
where URLHASH = checksum(@queryURL)
and URL = @queryURL
--建hash value列
alter table TAB
add URLHash as checksum(URL);
go
--在hash value上创建clustered index
-- create a non-unqiue clustered index on the hashed column for collisions.
create clustered index IX_URLHash
on TAB(URLHash);
go
--查询处理
select customerId
from TAB
where URLHASH = checksum(@queryURL)
and URL = @queryURL
--建hash value列
alter table TAB
add URLHash as checksum(URL);
go
--在hash value上创建clustered index
-- create a non-unqiue clustered index on the hashed column for collisions.
create clustered index IX_URLHash
on TAB(URLHash);
go
--查询处理
select *
from TAB
where URLHash = checksum(@queryURL)
and URL = @queryURL
go
--任何index无非是filter and refine的原理, hash来处理url比较合适,collision不会太多
[Quote=引用 27 楼 sigmod 的回复:]
用 Hash:
--建hash value列
alter table TAB
add URLHash as checksum(URL);
go
--在hash value上创建clustered index
-- create a non-unqiue clustered index on the hashed column for collisions.
create clustered index IX_URLHash
on TAB(URLHash);
go
--查询处理
select customerId
from TAB
where URLHASH = checksum(@queryURL)
and URL = @queryURL
--建hash value列
alter table TAB
add URLHash as checksum(URL);
go
--在hash value上创建clustered index
-- create a non-unqiue clustered index on the hashed column for collisions.
create clustered index IX_URLHash
on TAB(URLHash);
go
--查询处理
select customerId
from TAB
where URLHASH = checksum(@queryURL)
and URL = @queryURL
任何index无非是filter and refine的原理, hash来处理url比较合适,collision不会太多