Subject Where to put my indexes?
Author Zd
I'm bringing this to a new thread because it remained unanswered in the other.

Let's say I have this table

TABLE Calendar
EventID Integer Primary Key (auto-incremented)
UserID Integer
StartTime TimeStamp
EndTime TimeStamp
Description VarChar(1000)
etc.

I query this table in two ways:

A) SELECT StartTime, EndTime, Description, etc. FROM Calendar WHERE EventID = ...

B) SELECT StartTime, EndTime, Description, etc. FROM Calendar WHERE UserID = ... AND StartTime <= ... AND EndTime >= ...

Please note that UserID would have very low index selectivity (around 0).

Where do I put my indexes for the best performance?

Should I create a compound index on UserID, StartTime, EndTime? Or StartTime, EndTime, UserID?
Does the order matter? Do I need a compound index at all? What's the best way?

Thanks!

[Non-text portions of this message have been removed]