Optimizing Prefetch for Postgres IN Limit

2018-07-24 Thread Ram Jayaraman
Is there a prescribed pattern to optimize Prefetches when the expected Prefetch list is known to exceed 100 ? We are on Django 1.8 + Postgres 10. PG has a limit of 100 for values in IN queries after which the Index on the said column is not used. For ex: a typical Prefetch generating an IN query

Re: Prefetch Related with Multiple Column Join

2016-06-18 Thread Ram Jayaraman
in this case. > > By the way the check was adjusted in Django 1.10 to also take > `unique_together` > into account[1]. > > Cheers, > Simon > > [1] > https://github.com/django/django/commit/80dac8c33e7f6f22577e4346f44e4c5ee89b648c > > Le samedi 18 juin 2016 13:35:2

Re: Prefetch Related with Multiple Column Join

2016-06-18 Thread Ram Jayaraman
= ForeignObject( > 'PublisherMediumBilling', from_fields=['publisher', 'medium'], > to_fields=['publisher', 'medium'] > ) > > publisher.articles.select_related('billing') > > Cheers, > Simon > > Le same

Prefetch Related with Multiple Column Join

2016-06-18 Thread Ram Jayaraman
I apologize if this is an old question, I did search SO/google for a good few hours. I have the following models. Publisher() name = CharField() Medium() name = CharField() Article() publisher = ForeignKey(Publisher, related_name="articles") medium = ForeignKey(Medium, related_name="ar