unnecessary select

15 views
Skip to first unread message

otop...@gmail.com

unread,
Jul 23, 2014, 6:45:10 AM7/23/14
to qdj...@googlegroups.com
Hi,
When I create query set and then do filter() there are two selects in debug output - first one selects all from table and second is that filter.

QDjangoQuerySet<Table> table;
matched
= table.filter(QDjangoWhere("other_id", QDjangoWhere::Equals, otherId)).selectRelated().limit(20,80);

Produces:


SELECT `table`.`id`, `table`.`other_id` FROM `table`

SELECT `table`.`id`, `table`.`other_id`, T0.`id`, T0.`name` FROM `table` INNER JOIN `other` T0 ON T0.`id` = `table`.`other_id` WHERE `table`.`other_id` = ? LIMIT 80 OFFSET 20


How should I use the query set to make just the second select? - the first is unnecessary - I am going to have lot of items in table so it would kill the efficiency gained with limit.
Thanks





Reply all
Reply to author
Forward
0 new messages