Optimize quota calculations for workspaces
The count queries especially when grouped by agents+users will be challenging, but can be fixed with partial indexes at after 100K records. I'll open a followup issue for future performance.
Expected roadmap
-
Until 100K workspaces usually no action needed -
After that we can still optimize agent+user workspace countings by indexes -
After a point, we need to compute the counts in a worker daily or hourly for example, and store or cached the results a actual_workspaces_quota_used
etc.
Edited by Alper Akgun