composite-index

Why would you have a clustered composite index when none of the fields are used together?

In a legacy database (SQL Server 2000), we have a clustered index that looks like this: CREATE CLUSTERED INDEX [IX_usr] ON [dbo].[usr] ( [uid] ASC, [ssn] ASC, [lname] ASC ) The thing is, as far as I know none of these fields are used together in a WHERE clause. Nor is there really any reason to use any of them together. ...

Difference between 2 indexes with columns defined in reverse order

Are there any differences between following two indexes? IDX_IndexTables_1 IDX_IndexTables_2 If there are any, what are the differences? create table IndexTables ( id int identity(1, 1) primary key, val1 nvarchar(100), val2 nvarchar(100), ) create index IDX_IndexTables_1 on IndexTables (val1, val2) GO create index IDX_IndexTab...

Can DataMapper properties appear in multiple composite indexes?

I found that this issue had been discussed in Ticket #58 of DataMapper, apparently way back in 2007, but I can't find how to do it in the latest version (dm-core-0.10.2). I want to define two composite indexes, each of which are partially based on a certain property. I was hoping I could do this... class Stat include DataMapper::Resou...

How to index collection by using composite key

I have this class public class Item { public int UniqueKey; public int Key1; public int Key2; public int Key3; public int Key4; public string Value; } and the collection IEnumerable<Item> I want to create indexes on items of this collection by Key1, or by Key2, or composite one (Key1 and Key4). The number of ...