MySQL datatypes - UNSIGNED INTEGER vs BIT(32)

352 views Asked by At

I need a bitfield column in my MySQL database and I heard from the datatype BIT(M) where M is the number of bits and of course there is the datatype UNSIGNED INTEGER which holds 32 bits (0 - 2³²-1).

Of course, for a bitfield, BIT is better because I can set the number of bytes exactly as high as necessary. But I need to access the bitfield using JDBC and I could not find a good way to read and set bitfields from JDBC.

Is it in this case just better to use the UNSIGNED datatype which's size is next to the wished bitfield size? For JDBC it would simplify everything. But are there any serious performance/diskspace drawbacks?

0

There are 0 answers