Hi, all:

I encountered another redundant SQL query problem while using django.
And this time it might even cause a defect of my own program.

Here is the thing. I want to do something like below:
FOO.objects.filter( bar_id__exact = 5 ).delete()

But what I got from mysql log are:

1 SELECT blahblahblah... FROM `foo` WHERE (`foo`.`bar_id` = 5 ) LIMIT 100
2 DELETE FROM `foo` WHERE `id` IN (7, 10, 13)
3 commit
4 SELECT blahblahblah... FROM `foo` WHERE (`foo`.`bar_id` = 5 ) LIMIT 100

Questions are:
1. For Line 1, why it LIMITed the number of results to 100 while i'm
hoping to delete them all?
2. For Line 1 and 2,  is there any way to do "DELETE FROM 'foo' WHERE
('foo'.'bar_id' = 5)"?
    I think this is a quite common scenario.
3. For Line 4, is that a double check? Why would I need this query?

I'm new to django, thanks for all your kind help.

-- 
Regards.
-Tian

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to