Tuesday, October 29, 2013

Django Transactions Performance increase

Hi,

I have been doing some reading and am looking to increase the performance of updating existing database entries via incoming datafeeds.

I am finding conflicting opinions if wrapping updates in a transaction context manager helps improve performance, some sources say it does, others say it simply provides data integrity across the queryset within the transaction and no performance improvements and others have cited the transaction management overhead actually degrades performance;

for instance:

with transaction.commit_on_success()
for row in updatedata:
i = item.objects.get(id=row[0])
i.foo = row[1]
i.baa = row[2]
i.save()

for row in updatedata:
i = item.objects.get(id=row[0])
i.foo = row[1]
i.baa = row[2]
i.save()

Some clarification on this matter would be greatly appreciated. Also any pointers to improve my updating efficiency would be appreciated (although I know I cannot do a filter and a .update() on the queryset, as each row's update data is distinct).

Thanks.

Regards,

Robin.

--
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+unsubscribe@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/8dd77008-1715-4c63-9860-d82ce5c65131%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment