mysql - 如何对海量设备ID编号?
天蓬老师
天蓬老师 2017-04-17 13:31:02
0
1
447

有一批海量的设备ID,都是MD5的32字节的字符串,想用Bitmap索引来保存每个设备的某个状态(0或1),但需要把设备ID一一映射到bitmap对象的每一位上,其实就是要把对设备进行整型数字的编码。
开始想用mysql表的自增列来实现,先查询,没有就插入,再取自增的ID,但这样在高并发的情况下,mysql单点可能支撑不住,不知道有没有其它好的办法可以实现设备ID到Integer的映射。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
刘奇

Use GUID. When you need an id but don't need to specify its type or what the id means, but just need different values, GUID is your best choice. Moreover, there is a local expression method of GUID on every platform, so you don’t have to worry about the data being unreadable.

But then again, why does it have to be int? If this is just your inner OCD, you might as well just use the device's own 32-byte string. Anyway, if you add indexes to the database, it will be the same.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template