-
Notifications
You must be signed in to change notification settings - Fork 772
Performance of Queries #1264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@king-11 Can you post the screenshots of your django_debug_toolbar ? Looking at the SQL queries would help. I guess django-filter doesn't change queryset for blank queries. |
@king-11 See my #1263 (comment) — it's essentially the same issue. If you can provide a better queryset to the filterset's form you can greatly reduce the number of queries you need to make. |
@carltongibson as such am already using the most optimised queryset using prefect_related and select_related options which is visible because the number of queries then made are 3 only the issue that I saw was some duplicate queries were made |
@AviKKi here with filterset class and no query parameterswith no filterset class and no additional filtering |
Check that those are actually duplicate queries first (There's an issue in debug toolbar django-commons/django-debug-toolbar#1239) It's likely only the one is real. (Do they have the exact same trace?) Also, check the time disabling SQL tracing, as that's pretty slow. You'll likely find it's MUCH faster. If your SELECT FROM image_store_photographer is already using the best queryset then there's not much else you'll be able to do (indexes maybe) — ultimately it HAS to fetch the values sometime. (If it's static you can cache...) Hopefully some of that helps. |
Ohh thanks for looking up that issue @carltongibson. Yeah I will lookup caching thanks for your advice :)) |
In was profiling the SQL queries made using django_debug_toolbar even though I wasn't providing any query_param, the SQL queries are taking up a lot of time.
So to improve time when not filtering I implemented two separate views, I think those SQL queries are redundant and can really improve the filter performance when not filtering so how can I do that or is it part of django_filter only.
The text was updated successfully, but these errors were encountered: