Re: Automatic prefetching in querysets

2017-08-17 Thread Malcolm Box
Hi, I think there's a potential to make this opt-in, and improve the out-of-box experience. Summarising the discussion, it seems that the rough consensus is that if we were building the ORM from scratch, then this would be entirely sensible behaviour (with necessary per-QS ways to disable) - i

Re: Automatic prefetching in querysets

2017-08-17 Thread Andrew Godwin
Just some quick thoughts, as most of the points I would bring up have been discussed: - This should definitely be opt-in for the first release, it's too big a change to make opt-out straight away. - You should be able to turn it on/off per model, probably in Meta, not in a setting, and obviously

Re: Automatic prefetching in querysets

2017-08-17 Thread Collin Anderson
"turn it on/off per model" - I wonder if we just have a custom manager/mixin for the per model case. objects = AutoPrefetchRelatedManager(). The manager can return a queryset with prefetch_related(auto=True) or whatever already applied. On Thu, Aug 17, 2017 at 1:33 PM, Andrew Godwin wrote: > Jus

Re: Automatic prefetching in querysets

2017-08-17 Thread Aymeric Augustin
Hello, > On 17 Aug 2017, at 14:48, Luke Plant wrote: > > On 16/08/17 23:17, Aymeric Augustin wrote: >> It should kick in only when no select_related or prefetch_related is in >> effect, to avoid interfering with pre-existing optimizations. It's still >> easy to construct an example where it wo

Re: Default to BigAutoField

2017-08-17 Thread Kenneth Reitz
I have opened a pull request: https://github.com/django/django/pull/8924 Andrew and I came up with a good solution for migrations, together at DjangoCon. On Wednesday, June 14, 2017 at 7:36:36 AM UTC-7, Melvyn Sopacua wrote: > > On Friday 09 June 2017 15:59:50 Kenneth Reitz wrote: > > > Howeve

Re: Default to BigAutoField

2017-08-17 Thread Andrew Godwin
To elaborate on the solution we eventually came up with - we default models to use a new BigAutoField that migrations will pick up on and generate migrations to alter columns to, but for safety reasons for those that don't read release notes, made the migration autodetector ask you if you want to m

Re: Automatic prefetching in querysets

2017-08-17 Thread Anssi Kääriäinen
On Thursday, August 17, 2017 at 11:30:45 PM UTC+3, Aymeric Augustin wrote: > > Hello, > > > On 17 Aug 2017, at 14:48, Luke Plant > > wrote: > > > > On 16/08/17 23:17, Aymeric Augustin wrote: > >> It should kick in only when no select_related or prefetch_related is in > effect, to avoid interf