c++ - Custom size integers in MySQL and Sparksee databases -
is there way define type of integers, 7 bits long? or @ least 1 byte long? want replace standard integers stored in database reduce size. using databases: mysql, sparksee (for graphs). , languages: c++, objective-c++. using char instead of int - best option?
mysql supports tinyint (8 bit), smallint (16 bit), mediumint (24 bit), int (32 bit), , bigint (64 bit) data types. http://dev.mysql.com/doc/refman/5.7/en/integer-types.html
the corresponding c language data types int8_t, int16_t, int32_t, , int64_t. there isn't standard 24-bit data type in c. see more information. http://www.nongnu.org/avr-libc/user-manual/group__avr__stdint.html
these signed data types. so, example, int8_t has potential values in range [-128, 127].
you need large number of records in system cost saving using smaller integers exceed 1 dollar us. ssd drives cost less $0.50 per gigabyte. best spend time , effort elsewhere.
Comments
Post a Comment