FreeHealth / freehealth

Free and open source Electronic Health Record
https://freehealth.io
Other
45 stars 16 forks source link

store UUIDs as optimized binary(16) instead of varchar(32) #111

Open jeromecc opened 7 years ago

jeromecc commented 7 years ago

space

switch to binary(16) for space, it is particularly relevant for databases using utf8mb4 (130 bytes instead of 16 bytes when dashes removed and UNHEX(value)

performance

If UUIDs of type 1 were issued by the server, we could rearrange the 4 hex digits groups to improve index performance and use UUIDs as primary keys for the user and patient tables 1. Current version of UUID used is 4 (totally random). Should we use type 1, created by the database, to improve indexing? For this performance improvement, UUIDs should be generated by the same machine (the MySQL server). We could do this in the future:

jeromecc commented 7 years ago

We can move to type 1 UUID immediately without rewrite anything else than 1 function and without breaking anything.

jeromecc commented 7 years ago

In fact Qt cannot easily create UUIDs of type 1. Let's keep type 4 until we get rid of SQLite, then we will use the RDBMS (My/Maria) to generate type 1 UUIDs.

jeromecc commented 7 years ago

fhio v0.11 will use uuids stored binary(16) in patients database (PATIENT_IDENTITY table). To simplify database update, other changes will be implemented once SQLite is discontinued.