Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use sub query for user visibility filter
In case there are many service instances related db queries might become very complex: ``` SELECT * FROM \"services\" WHERE ((\"services\".\"id\" IN (7)) AND (\"id\" IN (<super long list of service ids>))) ``` This can lead to high memory consumption on the api VMs and can also cause memory bloats as everything is loaded into memory. With this change we change the query to use a sub query instead: ``` SELECT * FROM \"services\" WHERE ((\"services\".\"id\" IN (7)) AND (\"id\" IN (SELECT DISTINCT \"service_id\" FROM \"service_plans\"))) ``` Co-authored-by: Philipp Thun <[email protected]>
- Loading branch information