Hi, I think both are a form of 'optimistic locking' but I do think that adding a version-column should give better performance, because the WHERE-clause is simplified a lot, not having a potentially large number of expensive string-comparisons (and the data-caching form might give problems with CLOB / BLOB fields).
Regards, --Tim -----Original Message----- From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ChaosKCW Sent: zaterdag 4 maart 2006 23:57 To: Django users Subject: Re: Django in a Load-Balanced environment (ORM issues) ... [...] Another appraoch is not to change the Schema at all. Unneccessary and unrelated fields in the Schema is messy. Instead you can use 'Optimisitic Locking'. All you need to do to perform optimistic locking is add every column you are changing to the where with the old value. The only requirement is to keep the old value. A version might save on memory somewhat, but optimistic locking has he advantage of not needing to alter the schema. So if you load a model up e.g Model.ID = 123 Model.Field1 = 'ABC' and then you change it: Model.Field1 = 'DEF' Model.OldValues['Field1'] = 'ABC' When you save the object you add the old value to the where clause update model.tablename set Field1 = 'DEF' where ID = 123 and Field1 = 'ABC'; This achieves the same effect as a version. An exception can be thrown if the update fails, or handled in any number of ways. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---