HI Steve!

Thanks for the reply.  I have tried select related and prefetch related....but 
didn't know about defer....will look into...my current formset scenario is 
440ish queries and it takes about 19 seconds to load.  Some have suggested 
Celery and RabbitMQ and other alternatives which I'm not familiar with.  I need 
to explore those things further.  I have used the debug toolbar as well....it 
shows me that there are lots of duplicate queries...but I'm unclear on how to 
go about fixing them...as the select related and prefetch hasn't seemed to help 
either.

I'm using class based views with formsets and just kind of at a loss right now 
as to if there is anything that can be done to speed up these queries.  I 
opened up a SO on the issue...and got some suggestions on how to go about 
improving my dictionary look up...but after trying some of those suggestions 
the performance issue remains.

Thanks again for taking the time to respond.

Steve
________________________________
From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf 
of Steven Mapes <st...@jigsawtech.co.uk>
Sent: Sunday, February 6, 2022 11:47 AM
To: Django users <django-users@googlegroups.com>
Subject: Re: Formsets

For me using select_related, prefetch_related and defer generally soft the 
issues. If that's still too slow then, if possible, you could look at using 
caching the queryset(s) you need the values. Have you run debug toolbar on the 
page to check what queries are running?

On Saturday, 5 February 2022 at 20:27:10 UTC stevesm...@hotmail.com wrote:
Hello all!

I find formsets wildly useful...but very difficult to architect.  I have them 
working...But I am running into a commonly documented problem...They are slow 
as you build up the number of fields and queries.  Are there any general tips 
that can be used or share on how to improve this issue?  I have tried all of 
the commonly prescribed 
solutions...select_related...prefetch_related...etc...But nothing seems to help.

I realize that Queries take time....but I'm just trying to see if there is a 
way to streamline them a bit.  It seems to me that formsets use a lot of 
queries depending on the amount of data and that's the trade off.

Again thanks for any thoughts or comments.

Steve


--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6513c105-8151-4c7a-8fd2-e692d5c5dcb5n%40googlegroups.com<https://groups.google.com/d/msgid/django-users/6513c105-8151-4c7a-8fd2-e692d5c5dcb5n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CH0PR18MB42921F540CB239D4F5E250CCD22B9%40CH0PR18MB4292.namprd18.prod.outlook.com.

Reply via email to