Is any pros of using BIT(64) instead of UNSIGNED BIGINT in MySQL except representation

て烟熏妆下的殇ゞ 提交于 2021-02-11 17:55:34

问题


I need to have bitmask in database. 64 bit is enough. Most use cases SELECT ... WHERE ... AND mask & value > 0 ... There are exist special datatype: BIT(64) for my case. But MySQL can make bit logical operations with BIGINT too.

What I understand at this moment about BIT:

Pros:

  • Better visual representation 0b10010000 better 144 (but I can make CONV(144,10,2) with integer and get same representation)

Cons:

  • Worse support of type (I had some problem in golang, and wrote own type to work with it), integer much more popular and easy to work with it
  • Integer types give very little bit less traffic
  • Integer more compatible with other databases

I thinking maybe BIT not worth it, and I can use UNSIGNED BIGINT, but don't want to make wrong decision for future of my database.

P.S. also I'm looking to use PostgreSQL, and there are only integer types. (Not going to migrate, but to use in another cases)

来源:https://stackoverflow.com/questions/63953979/is-any-pros-of-using-bit64-instead-of-unsigned-bigint-in-mysql-except-represen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!