[development] Unique/Random IDs and drupal

Ethan Fremen ethan at acquia.com
Sun Aug 10 19:49:58 UTC 2008


Gentlebeings,

I've read the recent thread on devel->staging->deployment, and I  
wanted to share what I've done in the area.

My main interest lies in moving away from monotonically incrementing  
integers as id values so I have a greater chance of being able to  
"shard" the drupal DB for high performance.

As a first step, I am working on moving drupal core to using 64 bit  
integers. It was relatively trivial to change schema to create 64 bit  
tables, but right now there's nothing in schema that marks "foreign  
keys" as also being special.

Would anyone object to schema requiring foreign ID references to be  
marked specially?

Anyway, the direction I'm interested in heading is a 64 bit int +  
creation date timestamp for every row; the two can be combined to form  
a valid UUID if there are useful reasons for doing so.

Note that Postgresql has UUID creating functions and MySQL 5.1 has  
uuid_short() which generates a 64 bit random int based on the UUID  
algorithm.  The UUID() algorithm in mysql 5.0 isn't viable for scaling  
purposes because it's not cluster-safe.

I do have some preliminary performance data on the speed at which one  
can create UUIDs: http://mindlace.net/archives/2008/06/23/generating-uuids-in-php-for-drupal/

I'm very interested in any feedback about the feasibility of at least  
widening the ids to 64 bits in D7.

~ethan


More information about the development mailing list