I am building a compound index, and I'm not 100% sure which way to include a bit
field that is part of the table. The index will be for something similar to a list of forum topics, where I want the single index to be by ForumId
(int), IsSticky
(bit), then DatePosted (desc)
(datetime2(0))
But I want to make sure I handle the IsSticky
bit field properly; Do I index it as if true
is 1
or -1
? If it's 1, I would index IsSticky descending; if -1, I would index it ascending.
Also, I'm asking for SQL 2008, but I'd be interested in knowing if it's different in 2005.