Ban Management

Ban Management

193k Downloads

Why is player ID data type binary instead of INT?

TomLewis opened this issue ยท 2 comments

commented

I decided to open up my database via Sequel Pro on OSX, and noticed a lot of the data in banmanager tables scrambled, looking deeper the data types for some columns is bloody binary!? is there a reason you are storing player ID's as binary data type instead of INT?

commented

Yes, it's not possible to represent a UUID as an integer.

It's stored as binary to optimise storage space as well as provide a very fast index for lookups.

You can convert the data to human readable strings through the HEX and UNHEX functions in MySQL.

SELECT HEX(player_id) AS id, player_name FROM bm_players WHERE player_id = UNHEX('player-uuid-here');
commented

Aha fantastic, this makes sense, thank you for the example that I can use.