Skip to content
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

Optimize dandiset listing endpoint #1730

Merged
merged 3 commits into from
Oct 27, 2023
Merged

Optimize dandiset listing endpoint #1730

merged 3 commits into from
Oct 27, 2023

Conversation

jjnesbitt
Copy link
Member

This reduces the load time of the dandiset listing endpoint by optimizing the _get_dandiset_to_version_map function. This means the search endpoint should also experience a slight performance improvement, since it also uses that function.

The optimization is accomplished with the following changes:

  1. Removes an unnecessary query being made in the get_root_paths_many function
  2. Shifts the version stats aggregation to be done in postgres, making it more efficient
  3. Optimize the query for retrieving the latest version. Similar to the other optimized query, this leverages postgres aggregation to efficiently return the latest published versions for all relevant dandisets
  4. Use two smaller queries instead of one union-ed query when retrieving drafts and published versions, to take advantage of the last published version optimization.

Copy link
Contributor

@danlamanna danlamanna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, it seems like a performance improvement and a code simplification which is nice.

Co-authored-by: Dan LaManna <danlamanna@users.noreply.github.com>
@jjnesbitt jjnesbitt added patch Increment the patch version when merged release Create a release when this pr is merged labels Oct 27, 2023
@jjnesbitt jjnesbitt merged commit 2502136 into master Oct 27, 2023
10 checks passed
@jjnesbitt jjnesbitt deleted the optimize-dandiset-list branch October 27, 2023 18:11
@dandibot
Copy link
Member

🚀 PR was released in v0.3.59 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants