Re: Implement QuerySet.__contains__?

2020-06-03 Thread Johan Schiff
To answer my own question: No, I wasn't doing it correctly. I should have done a sanity check before posting. New timeit code and results at bottom, now using a smaller dataset (~900 objects). Notable: - An .exists() query is about 1/100 the time of full fetch in this case. This difference

Re: Implement QuerySet.__contains__?

2020-06-03 Thread Johan Schiff
Thanks for great info. First, I'm leaning towards Aymeric's proposition here. I do recognize that there is a lot to consider. This seems to be important: 1. Developers must be able to explicitly choose methods to optimize for their environment. (Considering database latency, dataset size,