hello everybody,
i wanna build a database-wide unique id. that unique id should be one field of every row in every table of that database. i have different ideas on how to achieve this, and really like to know whats your opinion...
First idea is to create one master-table with an auto-increment-field and a trigger in every other table, like "before insert here, insert in master-table -> get the auto-increment value -> and use this value as primary-key here"... i have seen something like this anywhere, but in fact: instead of making one INSERT, i would do 2 INSERTS, which should be not that performant.
The second one is to add a field "uniqueId" to every table, and fill this field with a PHP-generated integer... something like unix-timestamp plus a random number. but i had to use BIGINT as datatype, which means big index_length and big data_length.
Finally the third idea is also a "uniqueId" Field in every table, but instad of BIGINT i use VARCHAR and fill this with PHPs "uniqid()"...
im curious about your thoughts :-)
thanks, alex
p.s. im sorry if my english is not so well, its not my first language.