# Is there a performance penalty when column in fact table different size then dimension table?

**URL:** <https://forums.percona.com/t/is-there-a-performance-penalty-when-column-in-fact-table-different-size-then-dimension-table/468>\
**Category:** Other MySQL® Questions\
**Created:** [September 27, 2007, 9:02pm UTC](https://forums.percona.com/t/is-there-a-performance-penalty-when-column-in-fact-table-different-size-then-dimension-table/468 "2007-09-27T21:02:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikec](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mikec](https://forums.percona.com/u/mikec)\
**Post date:** [September 27, 2007, 9:02pm UTC](https://forums.percona.com/t/is-there-a-performance-penalty-when-column-in-fact-table-different-size-then-dimension-table/468/1 "2007-09-27T21:02:50Z")

</div>

Have several very large fact tables (100+ million rows).

In doing some maintainence on one of these fact tables, I can  
squish the size of several of my dimension keys from int to smallint.

Don’t want to touch the other fact tables at this point in time.

Is there a performance penalty to having a dimension key in the fact table be  
of size smallint but still be of size int in the dimension table when a join  
is done?

Thanks,

Mike

---

<div class="post-metadata">

**Author:** ![sterin](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@sterin](https://forums.percona.com/u/sterin)\
**Post date:** [September 28, 2007, 7:11am UTC](https://forums.percona.com/t/is-there-a-performance-penalty-when-column-in-fact-table-different-size-then-dimension-table/468/2 "2007-09-28T07:11:35Z")

</div>

| [B]mikec wrote on Fri, 28 September 2007 04:32[/B] |
| 

Is there a performance penalty to having a dimension key in the fact table be  
of size smallint but still be of size int in the dimension table when a join

 |

Generally yes, because you are forcing MySQL to perform an implicit data conversion on all records involved in the join. The question in this case is if the extra CPU cycles outweigh the smaller table size and resulting less reads from disk.

My guestimation is that it doesn’t so I would stick with same type on both columns involved with the join.

---

<div class="post-metadata">

**Author:** ![mikec](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@mikec](https://forums.percona.com/u/mikec)\
**Post date:** [September 29, 2007, 11:11am UTC](https://forums.percona.com/t/is-there-a-performance-penalty-when-column-in-fact-table-different-size-then-dimension-table/468/3 "2007-09-29T11:11:41Z")

</div>

Thanks, I’ll do that
