Re: Optimized Query

2020-05-29 Thread Soumen Khatua
Hi, Yeah, but whenever I'm trying to iterate a loop on all these qs. I'm getting an *error too many sql variables.* I know I'm doing something wrong,but I'm not able to find the error. Thank you for your response and time. Regards, Soumen ‪On Fri, May 29, 2020 at 5:49 PM ‫אורי‬‎ wrote:‬ > Th

Re: Optimized Query

2020-05-29 Thread אורי
They both work for both. אורי u...@speedy.net On Fri, May 29, 2020 at 12:47 PM Sencer Hamarat wrote: > I thought select_related works for only FK/M2M and prefetch_related works > for only reverse relations, doesn't it? > > Saygılarımla, > Sencer HAMARAT > > > > ‪On Fri, May 29, 2020 at 7:32 AM

Re: Optimized Query

2020-05-29 Thread Sencer Hamarat
I thought select_related works for only FK/M2M and prefetch_related works for only reverse relations, doesn't it? Saygılarımla, Sencer HAMARAT ‪On Fri, May 29, 2020 at 7:32 AM ‫אורי‬‎ wrote:‬ > Hi Soumen, > > Sometimes prefetch_related is much faster and more efficient than > select_related.

Re: Optimized Query

2020-05-28 Thread אורי
Hi Soumen, Sometimes prefetch_related is much faster and more efficient than select_related. I usually prefer to use prefetch_related. Uri. אורי u...@speedy.net On Thu, May 28, 2020 at 12:42 AM Soumen Khatua wrote: > Actually I want to fetch all users from User table and users location from >

Re: Optimized Query

2020-05-27 Thread Soumen Khatua
Actually I want to fetch all users from User table and users location from Location table which is many to many relation from same Profile table. Is it possible??? On Thu 28 May, 2020, 2:54 AM Soumen Khatua, wrote: > Now I'm facing one problem whenever I'm trying to iterate a loop I'm > getting