-
Notifications
You must be signed in to change notification settings - Fork 133
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
Improve prefetch by the Project model #1497
Comments
Begs the question, should we return filtered dataviews at the project end point? Cc @ivermac |
We do get the same issue even when the prefetch is not being used, right? Was the issue that we request xforns for each filtered dataview - XML + JSON? |
@ukanga @lincmba @ivermac @JohnMwashuma @jasonrogena I think we have one major question before us: Do we need to return dataviews from the projects endpoint? Regardless of whether we do or not, I believe that we need to modify the prefetch block of To illustrate, if you run: print(Project.prefetched.get(id=1337).xform_set.all().query) You get: SELECT "logger_xform"."id", "logger_xform"."xls", "logger_xform"."json", "logger_xform"."description", "logger_xform"."xml", "logger_xform"."user_id", "logger_xform"."require_auth", "logger_xform"."shared", "logger_xform"."shared_data", "logger_xform"."downloadable", "logger_xform"."allows_sms", "logger_xform"."encrypted", "logger_xform"."deleted_by_id", "logger_xform"."sms_id_string", "logger_xform"."id_string", "logger_xform"."title", "logger_xform"."date_created", "logger_xform"."date_modified", "logger_xform"."deleted_at", "logger_xform"."last_submission_time", "logger_xform"."has_start_time", "logger_xform"."uuid", "logger_xform"."bamboo_dataset", "logger_xform"."instances_with_geopoints", "logger_xform"."instances_with_osm", "logger_xform"."num_of_submissions", "logger_xform"."version", "logger_xform"."project_id", "logger_xform"."created_by_id", "logger_xform"."has_hxl_support", "logger_xform"."last_updated_at", "logger_xform"."hash", "logger_xform"."is_merged_dataset" FROM "logger_xform" WHERE "logger_xform"."project_id" = 1337 ORDER BY "logger_xform"."id" ASC Which is not desirable because we pull all of the XForm fields. |
The data endpoint uses the stream http response if it has been configured. We could change all our endpoints to have this option as well. With this, and I stand to be corrected, it won't be that much of a concern to have dataviews and forms in the projects endpoint. |
In terms of how the data has been structured that aspect of streaming might not be possible on the projects endpoints, it will, however, work well on dataviews and forms endpoints. |
The above prefetch code will cause serious memory issues when dealing with a project that has a lot of dataviews.
In the case of one user who had over 400,000 dataviews in one project, she was never able to load the projects endpoint for that specific project as the onadata application would always get OOM killed.
The text was updated successfully, but these errors were encountered: