It is necessary to verify that the user has permission to view / edit data of a certain client.
This check occurs in almost all application operations.
Currently when I log in to the application, I make a single query on the database and check which clients are associated with the user and record it in a session.
When it is necessary to verify that the user has permission to view / edit client data, I make a FOR in the session and check if the client ID exists.
It turns out that there are users with permission to view / edit 5 clients and others with 300.
Burning in session and making a FOR will always be faster than a database query?
OBS : Data integrity is not a concern, only if reading an array will be faster than reading the database.