Re: Postgres 15 SELECT query doesn't use index under RLS

2023-10-18 Thread Alexander Okulovich
Hi Oscar, Thank you for the suggestion. Unfortunately, I didn't mention that on prod we performed the upgrade from Postgres 12 to 15 using replication to another instance with pglogical, so I assume that the index was filled from scratch by Postgres 15. We upgraded stage instance by changin

Re: Postgres 15 SELECT query doesn't use index under RLS

2023-10-18 Thread Alexander Okulovich
Hi Tom, If in fact you were getting decent performance from an indexscan plan before, the only explanation I can think of is that the repo_ids you are querying for are correlated with the tenant_id, so that the RLS filter doesn't eliminate very many rows from the index result. The planner would

Re: Postgres 15 SELECT query doesn't use index under RLS

2023-10-18 Thread Tom Lane
Alexander Okulovich writes: > We used the product with the default settings. The requests are simple. > We didn't change the hardware (actually, we use even more performant > hardware because of that issue) and DDL. I've checked the request on old > and new databases. Requests that rely on this