
Signature
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--
> INT only uses 4 bytes because it doesn't have the precision that DECIMAL
> has. How are you hoping to maintain the same precision when converting back
> and forth?
>
> By the way, if your column uses a precision up to 9 digits (decimal), it
> will only use 5 bytes.
Adam - -
Actuall, you're right. But, I do have data where smallint gives me
sufficient precision, so I would be storing two bytes instead of five
bytes for decimal. Is it worth it to convert in the view?
- - Herb
Adam Machanic - 15 Sep 2005 18:12 GMT
> Actuall, you're right. But, I do have data where smallint gives me
> sufficient precision, so I would be storing two bytes instead of five
> bytes for decimal. Is it worth it to convert in the view?
You'd have to test on your end, with your data, to make that
determination. But my gut instinct would be probably not. That's a pretty
small difference in size, and although it might add up substantially over
billions of rows and give an I/O benefit in that case, I don't think it
would work in the millions (you're talking about a only few megs difference
on that scale.) There is also the overhead of the type conversion, which
may be expensive over so many rows -- but as to whether it would defeat the
possible I/O benefit, I cannot say; I think it would depend on many factors,
including how CPU-bound your servers are, and how fast your disks are.

Signature
Adam Machanic
SQL Server MVP
http://www.datamanipulation.net
--