On 6 kesä, 02:05, Àlex Pérez wrote:
> Can someone tell me why the or in that query:
> print Counter.on_medicos.filter(loc__isnull=True).only("id").query
>
> ""SELECT `web_counter`.`id` FROM `web_counter` LEFT OUTER JOIN
> `locations_localidad` ON (`web_counter`.`loc` = `locations_localidad`.`id`)
Thanks!,
that query is making the join, and i wan't tho make a faster query, Joins
ar not slow but if i can avoid it better.
>>> print Counter.on_medicos.filter(loc_id__isnull=True).only('id').query
My solution was: instead of put null values on empty relations, put a 0
value.. It work's very go
That is how Django works.
So as you see, django makes query where it compares _joined_ table id as a
null. To make it happen (left outer) join must happen, otherwise it wouldn't
return any rows.
I agree that Django _could_ do a better and optimize query so that it would
query instead of under
Can someone tell me why the or in that query:
print Counter.on_medicos.filter(loc__isnull=True).only("id").query
""SELECT `web_counter`.`id` FROM `web_counter` LEFT OUTER JOIN
`locations_localidad` ON (`web_counter`.`loc` = `locations_localidad`.`id`)
WHERE (`web_counter`.`mode` = 1 AND `location
4 matches
Mail list logo