Groups | Blog | Home
all groups > sql server programming > august 2003 >

sql server programming : how to index this table?



Ray Higdon
8/14/2003 9:10:17 PM
How will you be inserting? Is this a static table? In your scenario without
knowing anything else you could put a clustered index on field1 and a
non-clustered on field2, it should only use that NCI as the clustered index
is your row locator in the NCI and would be a covering index. I suspect you
may have oversimplified your question, so if the real table has more columns
on it you might add that to your post

HTH

--
Ray Higdon MCSE, MCDBA, CCNA
---
[quoted text, click to view]

FN
8/14/2003 11:54:41 PM
I have a table that has character ranges in it, such as

FIELD1 FIELD2

1234 1235
1235 1841
1842 1849

Those 2 fields are fixed length char fields.

I need to do queries such as

SELECT * FROM TABLE WHERE @test BETWEEN FIELD1 and FIELD2


How should I index this table for speed? Two separate indexes on field1,
field2? Or a clustered index? Or...?

AddThis Social Bookmark Button