NickCraver / StackExchange.Exceptional

Error handler used for the Stack Exchange network
https://nickcraver.com/StackExchange.Exceptional/
Apache License 2.0
862 stars 170 forks source link

No index on a Datetime field #186

Closed maurmun closed 2 years ago

maurmun commented 4 years ago

Hello, I see no indexes with a Datetime field (eg LastLogDate, etc) as the first key in the index; this could speed up queries and aggregations based on date ranges. Moreover is there any need of having the Primary Key Clustered on the Id field? It is almost of no use in queries; I would have seen it as a Primary Key Non Clustered and a Clustered Index on a more "important" field, for example a DateTime one

NickCraver commented 3 years ago

We could add an index on the DateTime fields, but yes there is a need to have the primary key - if you don't have one you'll still have one, but it'll be a GUID and wider for every index reference bloating the database/storage overall.