开发者

Tinyint better to use or not

开发者 https://www.devze.com 2023-02-11 06:16 出处:网络
I have a question. Is tinyint better to use or not with a 64 bit OS. The Paging on this would be of 64 bit and not 8. And thus tinyint will consume same memory as int(4 byte).

I have a question. Is tinyint better to use or not with a 64 bit OS. The Paging on this would be of 64 bit and not 8. And thus tinyint will consume same memory as int(4 byte). How does it actually makes a differen开发者_开发问答ce?

Its for all language or db.


I think the best answer to performance questions like these is

Measure. Don't guess.

  1. Choose one or more dbms. (They don't all work the same.)
  2. Build a mock-up of your database using tinyint.
  3. Build another mock-up using integers.
  4. Load both with sample data.
  5. EXPLAIN and EXPLAIN ANALYZE queries on both databases.

Come back and tell us what you found. (You might be surprised.)


of course a tinyint is faster / smaller than a bigint.

smaller datatypes allow more pages per row, the data is smaller.. indexes are smaller.

it's a BIG deal.

0

精彩评论

暂无评论...
验证码 换一张
取 消