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
better144
(but I can makeCONV(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)