csghub-server
csghub-server copied to clipboard
Cp trending models performance enhance
Background
The query on the recom_repo_scores table for model trending sorts isn't using an index, which causes numerous slow queries when users visit the model home page.
Solution
- Add a special index to the
recom_repo_scorestable. - Add an API cache. The cache will only be used when an anonymous user visits and is not performing a search. Other scenarios, such as caching for the dataset homepage, can be considered for future implementation.
Why wasn't caching added for logged-in users?
Because logged-in users may be querying models visible within their organizations. If a user's organization changes, the cache could lead to data inconsistency.