Wednesday, April 24, 2013

performance of delete

I have a table that has 2.5 million rows and 9 columns that are all
int except for 2 varchar(255) - i.e. not that big of a table. I am
executing this statement:

Event_Message_Idx.objects.filter(event_id__in=event_ids).delete()

Where event_ids has around 1,500 items in it. There is an index on
event_id. This statement is taking 1 hour and 5 minutes to run. There
is nothing else hitting the database at that time, and the machine
it's running on is 97% idle and has plenty of free memory. This seems
extremely excessive to me. I would guess it's because of the in
clause. Perhaps this is more of a MySQL question when a django one,
but is there some better way to do a delete like this in django?

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment