I have a query that gets all employee duties for a start date and end date against a database.
Basically the table would be like
- Emp
- Duty
- StartDate
- EndDate
Should I give indexing for dates? what kind etc? to make things easier on db level (orm level for me it would be an attribute to set).There will be huge data depending on number of employees off course (expected) , better safe than sorry?
Please advice.
Assuming you have a primary key on this table, I would use non clustered indices on the date fields if you need to search them oftenly – this is more important the more data you have in the table.
Adding only two more indexes on the table shouldn’t hurt (though I wouldn’t index all fields – that is asking for trouble!).