go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.24k stars 5.5k forks source link

Remove num_watches column from table repository #32557

Open lunny opened 3 days ago

lunny commented 3 days ago

To keep consistent, a cron job will run in the background to check num_watches. For a big instance, it will become very slow. So I think we can remove the column and query the table when necessary.

delvh commented 2 days ago

and query the table when necessary

Erm… isn't that grafik?

If yes, this won't be a performance improvement. It will instead worsen the performance.

lunny commented 19 hours ago

and query the table when necessary

Erm… isn't that grafik?

If yes, this won't be a performance improvement. It will instead worsen the performance.

Yes, but it's a slight additional load. It commonly will only increase by about 1ms for this page. We can also optimize it with cache in future PRs. Why I couldn't do it because introducing cache in this place needs more refactors PR merged first such as #32506 and #32537