Editor and UUID primary keys?
Editor and UUID primary keys?
I've been thinking about switching to UUID primary keys instead of sequence id's. Just a general question of anybody doing this and what problems if any need addressed? It doesn't appear to me that Editor really cares what you use as the primary id as long as its unique. As it uses an internal index anyway it seems that there shouldn't be a performance hit either? I'm guessing I'll need to do a getter and a setter on the server scripts to convert back and forth between the DB internal 128 bit data type (I'm using Postgres) and the javascript string representation? Main motivation here is the use of multiple remote databases and the need to manage primary keys across all of them in a simple way. Alternative is to simply assign different sequence ranges on each db but it seems I might live to regret that some day as it scales out. Am I missing anything or is this just a dumb idea to begin with?
This question has an accepted answers - jump to answer
Answers
Editor will work just fine with a UUID (both client-side and the server-side libraries). The only thing you need to remember is to make sure that you have a trigger to insert a new UUID when the new row is created.
I doubt there will be any noticeable impact on performance. I've been using UUIDs for a recent project and it doesn't present any issues.
Allan
Thanks very much Allan, that's good news to hear. This will make things much easier. No more messing about with sequence functions, yahoo!!