Is the new Date better than the old Date?
We have a CalendarTimeUTC Dimension table in our Data Warehouse that looks like this:
The PK in the table is the CalendarTimeUTCId (clustered). This used to be a Int field. All fact tables have CalendarId in them (some of these are multi-billion row partitioned tables).
We want to go from putting a DATE value to DATE+HOUR value in this field.
Sample data (Old and New):
Now with the advent of SQL 2008, and the shiny new implementation of DATETIME, is there a reason to switch the dimension's ID column from INT to DATETIME?
开发者_JAVA百科How will it affect the Index Size in the fact tables? More importantly, how will it affect performance?
Datetime datatype takes up 8 bytes. Int datatype takes only 4 bytes. If you wanted to convert to a date datatype (because you needed to make use of date manipulation functions, for example), I'd suggest using smalldatetime which only takes 4 bytes.
As far as indexes and performance: because the indexes would be on the same physical size of data, I don't believe you'd see a performance hit nor an increase in the size of the indexes.
精彩评论