Are there any reasons to not use smallint when it fits the data?
7
votes
2
answers
839
views
Since PostgreSQL doesn't have 1-byte tinyint, the second best option would be smallint. However, I've read from various posts* that it may actually be slower because CPU's are optimized to operate on 32-bit integers, or there may be implicit conversions to 32-bit integers.
Besides these reasons, are there any other reasons I'm not yet aware of for not using integers smaller than 32-bits?
\* I can't find it now, and I could be wrong about this. What I understood from it is that smaller integers would save disk/index space. So, good for the database, but the web/computation server would need to convert it to 32-bit
Asked by davidtgq
(759 rep)
Sep 30, 2016, 09:22 PM
Last activity: Jan 6, 2025, 10:33 AM
Last activity: Jan 6, 2025, 10:33 AM