I have a table below
dbo.UserLogs
Id | UserId |Date | Name| P1 | Dirty
There may be several entries on userId [even in millions]
I have a clustered index in a Date column and very often query this table in time ranges. The Dirty column is not NULL and can only accept 0 or 1, so I have no indexes in Dirty
I have several million records in this table, and in one specific case in my application, I need to query this table to get all UserId that have at least one record marked dirty.
I tried this query - select a separate (UserId) from UserLogs, where Dirty = 1
I have only 10 million records, and it takes 10 minutes to do this, and I want it to run much faster than that.
[I can query this table in a date column in less than a minute.]
Any comments / suggestions are welcome.
my env 64bit, sybase15.0.3, linux
source
share