Hi folks -- I need to run a fairly CPU-intensive calculation nightly over a dataset that's already large and growing quickly. I'm planning to run this via a cron job, but would like to make sure that it neither eats up the entire CPU nor locks the database, so that my site can continue functioning in the meantime. The rough outline of what it needs to do is as follows:
class OtherThing(models.Model): anotherthing = models.ManyToManyField(Whatever) ... class Thing(models.Model): other_things = models.ManyToManyField(OtherThing, through='SomethingElse') ... for thing in Thing.objects.select_related('other_things', 'other_things__anotherthing__etc'): calculated = calculation_on_thing_and_its_otherthings(thing) # this mainly involves serialization to a great depth thing.calculated_data = calculated thing.save() Will the above approach lock the database for a while or eat tons of CPU? Any suggestions? I'm using Django 1.2, btw. Thanks, -Nan -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.