q = qs.query.get_compiler(qs.db).as_sql() with connection.cursor() as c: c.execute(q[0], q[1]) for r in c: yield r
Would it be possible to have something similar to values_list, but that executes directly through a cursor, improving performance? I'm sure it will be less flexible than values_list, but the extra performance will be nice.
Looking at the code of values list queryset, maybe is it possible to replace the call of results_iter to directly use execute_sql(MULTI) avoiding all the unnecessary ifs and loops that results_iter does that is mainly useful for other query set objects, but not for values list. I did a test with the above and values list queries were performing as good as using directly a django cursor, but not as good as using as_sql() and then the cursor, but very close.
What would be the issues of adding such and optimization to values list? I'm even thinking of manually monkey patching it so all my values list queries are improved in my project, since I use values list most of the time due to performance reasons since building objects on large results is extremely slow, blame on python sadly.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/35204d24-5d25-4dad-966b-8a8dea13ca1e%40googlegroups.com.