Moving From db identity sequence to UUID's. Any Advice?

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

Moving From db identity sequence to UUID's. Any Advice?

Postby chico » Wed Nov 14, 2012 10:43 pm

We're embarking on the task of moving to primary keys which use a UUID rather than a db identity sequence to be able to introduce syncing and offline functionality into our solution.

Does anyone have any do's or don'ts?

We are leaning toward making a new UUID PK column and the necessary UUID FK columns in our existing tables and NOT changing the existing column type and overwriting existing ID's with new ID's.

Is this a good idea?

Any better ideas?

Servoy Version: 6.0.3
DB: MySQL 5.1
Win XP/Vista/7 - Java 5u20 / 6u22
OS X - 10.6.5 - Java 5/6 update 3
Posts: 271
Joined: Tue Nov 20, 2007 6:34 am

Re: Moving From db identity sequence to UUID's. Any Advice?

Postby mboegem » Thu Nov 15, 2012 12:59 am

A definitely 'do' is try to generate the UUID directly via SQL
After that update al your new UUID fl-columns also using SQL

I used the above approach duplicating lots of records in order to copy metadata from 1 user profile to the other.
I don't remember the exact difference in speed doing it from within Servoy vs. raw SQL, but raw SQL managed to do this in just a couple of seconds (all depending on the number of records of course)

Another 'do' is:
if you didn't already used it, try to (re)write all your custom queries as prepared statements.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

User avatar
Posts: 1573
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Return to How To

Who is online

Users browsing this forum: No registered users and 1 guest