Storage RLS Performance Index not used with RLS enabled
Hey everyone,
I am having major struggles with the query performance of the storage.objects table and cannot get my head around it. Any help is highly appreciated.
We are providing a multi-tenant solution where different entities can have files attached. To easily query them on different levels, we enforce the following directory structure:
organisation-id/entity-id/myfile.jpg
organisation-id/entity-id/myfile.jpg
In some cases, we also have one more level, e.g. for conversation with messages, we want to attach files to a message but also query all files of a conversation:
For a better performance, we setup a bunch of indices, and when executed as service_role (bypassing rls), the indices are properly picked up (Visualised on explain.dalibo).
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.