A benchmark on PostgreSQL 17.10 and nearly two million invoices shows that a direct tenant policy using current_setting() can perform about as well as an explicit tenant filter when the right index is available. The cost depends on how the policy obtains the tenant and whether its expression can use the index.
The report measured a volatile PL/pgSQL helper at roughly 1.9 seconds where a simple indexed lookup took fractions of a millisecond, because the helper prevented the planner from using the tenant index. Declaring an appropriate helper STABLE, and considering parallel safety, restored efficient plans. The results underline that RLS policies need query-plan testing with realistic tenant sizes and connection-pool behavior.
