# \[solved\] Performance using INT/SMALLINT

**URL:** <https://forums.percona.com/t/solved-performance-using-int-smallint/180>\
**Category:** Other MySQL® Questions\
**Created:** [January 25, 2007, 4:15am UTC](https://forums.percona.com/t/solved-performance-using-int-smallint/180 "2007-01-25T04:15:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![texnoti](https://avatars.discourse-cdn.com/v4/letter/t/839c29/32.png) [@texnoti](https://forums.percona.com/u/texnoti)\
**Post date:** [January 25, 2007, 4:15am UTC](https://forums.percona.com/t/solved-performance-using-int-smallint/180/1 "2007-01-25T04:15:30Z")

</div>

Hi!  
Perhaps this is a question for INTEL or likewise but i figured someone would know.

I nag about using apropriate type for integer (and other). Don’t use INT when TINYINT is enaugh. That way storage space is saved.  
But last week someone mentioned that what you win in storage is lost in execution.

INT require 4 bytes and SMALLINT 2 bytes. The theory was that it’s faster to calculate with 4 bytes than with 1, 2 or 3 bytes and that the processor (?) anyway padds (or truncate) the value to 4 bytes.

Something to do with 32-bit processor and that 32/2=\> 16/2=8

Anyone who can explain this?

Rgds  
thomas

---

<div class="post-metadata">

**Author:** ![Peter](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/peter/32/2_2.png) [@Peter](https://forums.percona.com/u/Peter)\
**Post date:** [January 25, 2007, 4:21am UTC](https://forums.percona.com/t/solved-performance-using-int-smallint/180/2 "2007-01-25T04:21:22Z")

</div>

Do not mix storage and computation.

Computation is always done using signed 64bit integer in MySQL (even for 32bit)

---

<div class="post-metadata">

**Author:** ![texnoti](https://avatars.discourse-cdn.com/v4/letter/t/839c29/32.png) [@texnoti](https://forums.percona.com/u/texnoti)\
**Post date:** [January 25, 2007, 4:28am UTC](https://forums.percona.com/t/solved-performance-using-int-smallint/180/3 "2007-01-25T04:28:37Z")

</div>

Ok, so computing don’t get affected by the fact that i store a value as INT or SMALLINT?

---

<div class="post-metadata">

**Author:** ![texnoti](https://avatars.discourse-cdn.com/v4/letter/t/839c29/32.png) [@texnoti](https://forums.percona.com/u/texnoti)\
**Post date:** [January 25, 2007, 4:39am UTC](https://forums.percona.com/t/solved-performance-using-int-smallint/180/4 "2007-01-25T04:39:25Z")

</div>

Thanks!  
Btw, great blog and forum!!!
