I have a table that contains transactional data. Such as site view by
whom, when, which template, etc, etc...
Everytime when I pulled the report, hh:mm:ss never matters. Only
breakdown by dates, not time.
Having read some chapters of Ralph Kimball's book, I am inspired to
build "date" table with integer as primary key.
Here's what I have for schema of transactional table.
- viewed_customer _id int (4bytes)
- template_id uniqidentifier (16 bytes)
- viewed_on datetime (8 bytes)
And here's the version I am thinking of building
- viewed_customer _id int (4bytes)
- template_id uniqidentifier (16 bytes)
- viewed_date_key int (4 bytes)
- seconds int (4 bytes)
* I put seconds just in case I need to retrieve hour based or minute
based report.
Here's my question. I've also noticed that smalldatetime is also 4bytes
of memory but it consists of 2 sets of 2 bytes.
When I index, would there be significant performance difference between
indexing 4 byte of column and indexing 2bytes x 2 of column?
whom, when, which template, etc, etc...
Everytime when I pulled the report, hh:mm:ss never matters. Only
breakdown by dates, not time.
Having read some chapters of Ralph Kimball's book, I am inspired to
build "date" table with integer as primary key.
Here's what I have for schema of transactional table.
- viewed_customer _id int (4bytes)
- template_id uniqidentifier (16 bytes)
- viewed_on datetime (8 bytes)
And here's the version I am thinking of building
- viewed_customer _id int (4bytes)
- template_id uniqidentifier (16 bytes)
- viewed_date_key int (4 bytes)
- seconds int (4 bytes)
* I put seconds just in case I need to retrieve hour based or minute
based report.
Here's my question. I've also noticed that smalldatetime is also 4bytes
of memory but it consists of 2 sets of 2 bytes.
When I index, would there be significant performance difference between
indexing 4 byte of column and indexing 2bytes x 2 of column?
Comment