Re: performance of delete

2013-04-24 Thread Nick Santos
Related to the use of IN, but not an answer, I've found this series of article from ExplainExtended to be super helpful in optimizing some of my DB queries. These two are for MySQL, but the author has versions for Postgres and SQL Server as well. I know this help is limited with an ORM, but maybe

Re: performance of delete

2013-04-24 Thread Matt Long
I'm curious how long manually running a single delete query with the appropriate where clause would take. Surely there's a way to do that through the Django ORM without having to drop into raw SQL? That being said, there are limits to how long a given query can be, so the ORM would have to do

Re: performance of delete

2013-04-24 Thread Larry Martell
I changed it to delete one row at a time and it's taking 3 minutes. On Wed, Apr 24, 2013 at 6:38 PM, Setiaman Lee wrote: > Larry, > > > Avoid to use IN clause. I'd say to insert the events you want to delete into > the temp table. You can put the session id or user id in

Re: performance of delete

2013-04-24 Thread Setiaman Lee
Larry, Avoid to use IN clause. I'd say to insert the events you want to delete into the temp table. You can put the session id or user id in temp table to differentiate set of data from other users. Then do the delete by joining the temp table to the Event_Message_ldx table. your sql might look

performance of delete

2013-04-24 Thread Larry Martell
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