The problem: I need to generate a 'unique string' for each row in a
table. I already use auto_increment for system dependencies between tables.
What is the best approach one of these or another?
After generating a candidate 'unique string' the two strategies that
came to mind are:
1. to then search the table's column to see if it is already assigned;
locking the table for write while searching and writing the new row, or
2. set the column to UNIQUE when defining the table. Just go ahead and
write the new row if you get a "non-unique" exception, generate another
'unique string' and try again.
I've tried both on a small XP laptop and get "lock timeout exceptions"
rather quickly using #1. But replace those with lots of re-writes when
there starts to get "collisions" of 'unique string's.
Any recommendations on approaches?
Thanks in advance,
Roy