On 2014-09-03, at 4:22 PM, msoulier <msoul...@digitaltorque.ca> wrote:
> Hi, > > I am looking at Django's performance with respect to modifying large numbers > of objects, each in a unique way that cannot be batched. If I make a simple > change to one of my Django models and save(), and then do the same thing in > sqlalchemy, I notice a performance difference of about 48 times as far as the > rate that the objects are processed to my postgresql db. > > The code is a simple property update and save, in a loop, trying to process > as many objects as possible. > > Is the Django ORM known to be slower in this regard, or is it likely > something that I'm doing? I haven't had to deal with this myself, but the speed difference smacks of transactional issues. If you can run your loop by wrapping all of it or pieces of it (say, 100 or 1000 chunks) in a single transaction you'll probably see some significant speedup. https://docs.djangoproject.com/en/dev/topics/db/transactions/ hth - Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1193F2BD-2597-4D68-A8EE-D593FFD084EF%40gmail.com. For more options, visit https://groups.google.com/d/optout.