Ben Staude wrote: > Hi all, > > this is slightly off-topic, so if you know a better place for it, please let > me know. On the other hand, the guys here know a lot about using Databases > with perl... > > I'm wondering whether to use UUID instead of auto-increment pk in my database > (dbic, sqlite) app. Right now, I'm fine with the integer keys, but there > might eventually come the day that I want to "split" and "merge" the > database. As far as I understood, there's no better way to be prepared for > such things than uuid-keys.
uuid keys are reat for offsite, and other forms of replication where both side may be edited. > > What are the drawbacks I have to expect if switching to uuid-keys? I know I'd They are just slower than ints. Although with the proper indexes, I say you'll run into other performance issues in your apps lon before uuids become your problem. > have to add a dependency to Data::UUID (btw, is it the one to use?), but I DBIx::Class::UUIDColumns and ::UUIDMaker. IT takes care of usin the first available uuid eneration module (Data::UUID, UUID, Win32::UUIDen, APR::UUID, etc) > can't estimate the performance impact on inserts (not that critical) and > selects (< 100,000 records in the db). Disk space shouldn't be an issue. > > Do you all use it everywhere, or do you avoid it wherever you can? Maybe > there's some kind of "best practice" established? Using uuid-keys sounds > reasonable, but I wonder why they don't appear in every schema on the list... > > Thank you very much for any hints, > > Ben If I'm in a replication situation, I always use uuids. It's just easier than setting up auto increcement ranes for each replicaiton source. Personally, my hate aainst autoinc ints has been old versions of mssql. It wasn't terribly uncommon to have autoinc seed counts to be reset during table alterations, alowing ids to be enerated in gaps where records have been deleted. I like using uuids also when I want ids to be unique across tables...maybe for the purposes of logging. I also like using uuids as pks for url purposes. When I pass them in the urls or in forms, they aren't guessable, like ints are for trying to pull up other records. Just my $0.02 worth. -=Chris
signature.asc
Description: OpenPGP digital signature
_______________________________________________ List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class Wiki: http://dbix-class.shadowcatsystems.co.uk/ IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ Searchable Archive: http://www.mail-archive.com/[email protected]/
