MYSQL TINYBLOB vs LONGBLOB

前端 未结 1 1365
猫巷女王i
猫巷女王i 2020-12-20 12:20

This is a follow up for my previous question: Blob and Storage Requirement

I did some testing using SHOW TABLE STATUS, and found out that the total disk

相关标签:
1条回答
  • 2020-12-20 12:45

    Each size of blob field reserves extra bytes to hold size information. A longblob uses 4+n bytes of storage, where n is the actual size of the blob you're storing. If you're only ever storing (say) 10 bytes of blob data, you'd be using up 14 bytes of space.

    By comparison, a tinyblob uses 1+n bytes, so your 10 bytes would occupy 11 bytes of space, a 3 byte savings.

    3 bytes isn't much when dealing with only a few records, but as DB record counts grow, every byte saved is a good thing.

    0 讨论(0)
提交回复
热议问题