On Mon, 2021-03-15 at 16:28 +0100, Rafal Pietrak wrote: > 5. My experiments with RLS was like following: > - I've implemented a STABLE function, that returns INTEGER 1/0 > - I've linked that function as POLICY to my tables > - I've GRANTED PUBLIC access to those tables > ---> and all works as predicted.... only slow (10x slower!). > > [lots of questions about how to solve this is some other way] > > Those questions come from my bad experience with POLICY performance. You should figure out why RLS was so slow. The key to this is "EXPLAIN (ANALYZE, BUFFERS)" for the query - that will tell you what is slow and why, so that you can tackle the problem. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com