Best Practice for Storage RLS
Hey,
I am currently wondering if there is any kind of best practices for indices when setting up rls for storage?
Status Quo:
Since the folder path is concatenated in the "name" property of the storage.objects table I do not see a way to setup an rls and indice where the DB just look at the first or second part of the name path in a performance efficient way.
Example:
folder path: <organisation_id>/<team_id>/file_name
We have an RLS Setup that checks if the user has access to the team_id
Now I would like to setup an indice so that a user can access the files of his team very efficient, as currently we are performing very week index scan, which are actually full table scans.
Is there any kind of example for RLS and indice setup available or any tip to setup a RLS on folder level with the corresponding indices?
I am currently wondering if there is any kind of best practices for indices when setting up rls for storage?
Status Quo:
Since the folder path is concatenated in the "name" property of the storage.objects table I do not see a way to setup an rls and indice where the DB just look at the first or second part of the name path in a performance efficient way.
Example:
folder path: <organisation_id>/<team_id>/file_name
We have an RLS Setup that checks if the user has access to the team_id
Now I would like to setup an indice so that a user can access the files of his team very efficient, as currently we are performing very week index scan, which are actually full table scans.
Is there any kind of example for RLS and indice setup available or any tip to setup a RLS on folder level with the corresponding indices?