Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

TinyInt, SmallInt, Int and BigInt Expand / Collapse
Author
Message
Posted Monday, December 04, 2006 9:36 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 9:35 AM
Points: 2,749, Visits: 1,407
Comments posted here are about the content posted at temp

LinkedIn Profile
Post #327700
Posted Monday, December 18, 2006 5:46 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 32,906, Visits: 26,792

Nice article, David, as usual...

As you are aware, I suspect that any performance differences will only occur where joins of different data types occur due to implicit conversions... but I'm with you... size the columns correctly if for nothing else than to reduce the size of backups (the OTHER thing that designers always forget about).



--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #331174
Posted Monday, December 18, 2006 6:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, April 05, 2008 9:33 PM
Points: 2, Visits: 3
What happened to TinyInt?  Was it too small and thus overlooked?  It wasn't even mentioned in the article wven though it was included in the tag line.
Post #331181
Posted Monday, December 18, 2006 7:35 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, May 08, 2013 1:35 AM
Points: 139, Visits: 4,605

I like the article. But I think the important of a JOIN performance, too.
In my database, I have a table that has 14 foreign keys. So, I've a view that gets the information of this table joined with the 14 other tables. Maybe then the performance difference between these types are shown.
So I try to use always the smaller type possible.

Josep.
Post #331220
Posted Monday, December 18, 2006 7:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 04, 2008 7:13 AM
Points: 2, Visits: 4
I think what you are missing though is that the point about the different datatypes is that you should use the smallest datatype that makes sense in order to keep your row size to a minimum. The smaller your row size the more rows you can get on a page, which definately does help performance.
See http://www.sql-server-performance.com/nb_saving_space.asp for more info

Cheers
Ian
Post #331230
Posted Monday, December 18, 2006 8:29 AM
SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: Moderators
Last Login: Tuesday, April 09, 2013 12:53 PM
Points: 8,357, Visits: 684

However I would say plan for the long term. If you know you have a potential you will need the larger row size be prepared so you don't have to reconsider decission later. And as for the - I have use the following to del with printouts so I could still use the - side of the spectrum.

A = -
B = +

Your application can handle the translation or even handle in a Stored Procedure, butthe later means a longer string must be passed instead of the shorter interger value.

There are many ways to conserve space that are often overlooked and interger size is no different. Consider the fact that no matter how big or small your data is the value that is stored will always be the entire length of the datatype. So tinyint will be 1 byte, smallint 2, int 4 and bigint 8 event if the values is 0 it will be represented by all bytes for the datatype.

Decent article I would just say it probably needs to be a little more focus on it's point.




Post #331264
Posted Monday, December 18, 2006 9:00 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, December 25, 2006 9:49 AM
Points: 19, Visits: 1
Worthless in my opinion?


Post #331278
Posted Monday, December 18, 2006 9:05 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 2:27 PM
Points: 21,357, Visits: 9,537
Care to formulate a more complete idea?!?!?
Post #331281
Posted Monday, December 18, 2006 11:07 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 18, 2012 7:48 AM
Points: 4, Visits: 2
I wouldn't overlook the "natural" integer size of the processor( i.e.  32bit ).  During my numerical analysis classes they always stressed staying with float unless you needed the extra precission of a double.   Later when I got my first 386 I compiled my libraries with floats and doubles.   The functions using doubles where actually smaller   because to do a float calculation,   the internals would promote the float to a double,  do the calc then demote the answer.   
Post #331332
Posted Monday, December 18, 2006 11:47 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 2:27 PM
Points: 21,357, Visits: 9,537
Thanx for the tip.  Is there any link you can provide with information on the low level performance tuning like this one?
Post #331342
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse