csghub-server icon indicating copy to clipboard operation
csghub-server copied to clipboard

Cp trending models performance enhance

Open Rader opened this issue 4 months ago • 1 comments

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

  1. Add a special index to the recom_repo_scores table.
  2. 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.

Rader avatar Aug 25 '25 10:08 Rader