du248227 2019-07-28 19:04
浏览 1176

BigINT和VarChar的区别,长度为16个字符

I have question about the best solution to store number code

(example: 1234123412341234).

This code have always 16 chars and is numeric value!

I use InnoDB engine to store table

Currently i have type of column VarChar(16) but i have thoughts whether bigint is better for this.

Column code is not edited after added to database.

  • 写回答

3条回答 默认 最新

  • doulifang5554 2019-07-28 21:04
    关注
    • Bigint requires 8 Byte to store a number, while varchar(16) will require at minimum the double amount of Bytes. Depending on the character set used, even 4 times more. So type of bigint will save space on your disk but also reduce network traffic.

    • A varchar(16) will not be able to represent all bigint numbers. An unsigned bigint value of 0xFFFFFFFFFFFFFFFFFE can't be stored in a varchar(16) column.

    • On machine Level, a 16 Byte comparison usually happens in one cycle, while comparing strings is much more expensive, since varchar requires a byte to byte comparison.

    评论

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码