-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Suggestion: make query impact queryset to reduce django sql selection #237
Comments
I'm not sure if I have understood what you described, but isn't it what's performed by |
I'm currently using Django debug panel and when i use restql to reduce the amount of information, i can see that i fetch the whole objects (nested objects too) in the sql part, however i only need some precise informations. |
Are you using |
Yes i'm using it |
I’ve never tested this lib on Django debug panel but tests suggests otherwise take this below as an example django-restql/tests/test_views.py Lines 747 to 818 in 0d2d372
You can see there that the number of queries due to nested fields went from 5 to 2 after using EagerLoadingMixin .
|
I'm sorry but i have some difficulties to explain my issue. for example when i query |
Ooh!, now I got you. Djang RESTQL doesn't support this for now, but since you brought it we might think of a way to implement it, I think it could help boosting the speed of database queries. I know one way to make ORM select specific fields is applying |
This would be a nice addition, but I can foresee issues where there is no underlying field in the database table, even though it is represented in the serializer such as a Now that I think about this suggestion, I wonder if Django RESTQL limits the querying of fields if there is an explicit work_order = NestedField(
WorkOrderSerializer,
read_only=True,
fields=["work_order_id"] # will the query planner only pull `work_order_id`?
) |
Hi, i'm using this module for a while and i thinks it would be awesome if querys can impact the django queryset selection (with only and/or defer) to significantly reduce the amount of information being selected. But i do not know how to achieve this. Maybe this can be a feature to add to the module.
The text was updated successfully, but these errors were encountered: