I fully agree with marc_s's comment above, but I decided to make a test, just for fun.
I created two tables, one with a datetime
column and one with a bigint
column, representing the same data.
Here is the sql fiddle: http://www.sqlfiddle.com/#!3/74976/3
I've run this query for 500, 1000 and 5000 records and every time noticed that the execution plans are identical, so from a performance point of view there's no gain in using bigint
.
However, there are obvious downsides for the bigint
approach; some of them:
- the conversion to/from
bigint
requires more code to be written - operations like filtering by month require more complex/less readable queries
- looking at the result grid in Management Studio, you cannot "parse"/interpret the results as quickly as you could if you saw the separated date parts.