Using larger data type to avoid sum overflows?
3 posters
Page 1 of 1
Using larger data type to avoid sum overflows?
In SQL Server, there is the potential that a sum of an int column in a fact table may result in an overflow, depending on what attributes are being grouped on. In all queries we could cast the column to bigint beforehand, but I am considering if it is just better to go ahead and declare the column in the fact as the larger data type. This would basically trade space for ease of use and also avoid bugs that might occur, because without it someone might forget the cast to the larger data type when writing future queries. Wondering if anyone else has encountered/considered this and what your reasoning for which decision you made was.
Thanks, take care.
Thanks, take care.
AaronLS- Posts : 8
Join date : 2010-02-24
Re: Using larger data type to avoid sum overflows?
Make the column in the database as big as needed. Requiring users to cast the column on every query doesn't make sense.
BoxesAndLines- Posts : 1212
Join date : 2009-02-03
Location : USA
Re: Using larger data type to avoid sum overflows?
Agree! And also the fact tables are supposed to be as concise/normalised as possible for the purpose of space saving and performance. So having any over-kill data type runs against that principle.BoxesAndLines wrote:Make the column in the database as big as needed. Requiring users to cast the column on every query doesn't make sense.
hang- Posts : 528
Join date : 2010-05-07
Location : Brisbane, Australia
Similar topics
» Type-2 Dates as Date Data Type ?
» Is it a best practice that Data warehouse follows the source system data type?
» "Noisy" data
» Adjusting historic data in a type II SCD
» Data type matching between OLTP & DW
» Is it a best practice that Data warehouse follows the source system data type?
» "Noisy" data
» Adjusting historic data in a type II SCD
» Data type matching between OLTP & DW
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum