Re: Row level security performance joining large tables - Mailing list pgsql-general

From Tom Lane
Subject Re: Row level security performance joining large tables
Date
Msg-id 6336.1477776829@sss.pgh.pa.us
Whole thread Raw
In response to Row level security performance joining large tables  ("David R. Pike" <david.pike@trustedconcepts.com>)
List pgsql-general
"David R. Pike" <david.pike@trustedconcepts.com> writes:
> I recently applied RLS to several large (several million rows) tables in my 9.5 database and noticed that queries
againsta single large RLS protected table perform well however queries that join several large RLS protected tables
performvery poorly.  The explain plan shows the optimizer is scanning the entire table to enforce the RLS policy before
executingthe primary key join that would reduce the query results to a single row from each table.  Clearly performance
wouldbe better if it performed the join before the policy check. 

Join cases with RLS aren't optimized very well at the moment.  There's
work afoot to improve this - see
https://www.postgresql.org/message-id/flat/8185.1477432701%40sss.pgh.pa.us
- but it won't be in production before v10.

            regards, tom lane


pgsql-general by date:

Previous
From: Steven Hirsch
Date:
Subject: Re: What is the 'data2' directory for?
Next
From: Samuel Williams
Date:
Subject: Re: initdb createuser commands