Re: QuerySet performance on large datasets

2021-04-11 Thread Peter of the Norse
Follow up to my own message. I found a way of testing this that I think everyone should look at: $ ./manage.py shell Python 3.8.5 (default, Jul 21 2020, 10:48:26) [Clang 11.0.3 (clang-1103.0.32.62)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveCons

Re: QuerySet performance on large datasets

2021-02-12 Thread Peter of the Norse
bool(qs) is recommended when the queryset has already been run. If you do something like val = qs.earliest(some_property) if bool(qs) else None then there isn’t a performance gain because it still has to run qs.exists() to even see if there is a value. Later things like that will be cach

QuerySet performance on large datasets

2021-01-12 Thread 'Juergen H' via Django users
Dear django users, when working on very large datasets (millions of items) and performing queries on it, I have a few questions regaring the performance. - From my understanding using `bool(qs)` is preferred over using `qs.exists()` when the queryset is used later on, as `bool(qs)` alrea