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

Add new option for limiting query results #58

Closed
havok2063 opened this issue Sep 30, 2024 · 0 comments · Fixed by #63
Closed

Add new option for limiting query results #58

havok2063 opened this issue Sep 30, 2024 · 0 comments · Fixed by #63
Assignees
Labels
enhancement New feature or request

Comments

@havok2063
Copy link
Contributor

havok2063 commented Sep 30, 2024

Add a new option to limit the query return results, and return top n number. Related to sdss/zora#71

For more context, the feedback was "The idea would be to allow a person to test out a query without having to wait for a really long time.", which I think is to optionally just return a sample of results. In principle I like this idea. Generally this may be easy enough with peewee's paginate option or limit/offset.

The main long-running queries available right now are on target program/carton. Limit doesn't shorten these queries due to the distinct. See

def carton_program_search(name: str,

Adding limit takes the query https://api.sdss.org/valis/query/carton-program?name=manual_mwm_tess_ob&name_type=carton&observed=true&release=DR17 from ~5 seconds to ~8 minutes. Switching from a distinct to group by reduces the query time with limit from 8 to 4 minutes. With no limit, it's still 5 seconds. Timings are from direct sql in a psql terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants