Re: GIST/GIN index not used with Row Level Security

2019-08-14 Thread Derek Hans
> > > > I've updated word_similarity_op(text,text) to be leakproof, and > > pg_proc agrees it is. I'm assuming word_similarity_op() is equivalent to > > <%, though I haven't found explicit confirmation. However, using > > word_similarity() instead of <% on a 100k row table, without any RLS > > invo

Re: GIST/GIN index not used with Row Level Security

2019-08-13 Thread Derek Hans
k row table, without any RLS involved, doesn't make use of the index, while using <% does. Obviously, adding the RLS doesn't make that any better. Any idea what might be the cause? On Tue, Aug 13, 2019 at 5:39 PM Stephen Frost wrote: > Greetings, > > * Derek Hans (derek.h..

Re: GIST/GIN index not used with Row Level Security

2019-08-13 Thread Derek Hans
Thanks for the pointer for marking functions as leakproof, I was unaware of that whole concept. Unfortunately only "alter function" supports "leakproof" - "alter operator" does not. Is there a function-equivalent for marking operators as leakproof? Is there any documentation for which operators/fu

Re: GIST/GIN index not used with Row Level Security

2019-08-13 Thread Derek Hans
> > > Your example is obscuring the issue by incorporating a tenant_name > condition (where did that come from, anyway?) in one case and not > the other. Without knowing how selective that is, it's hard to > compare the EXPLAIN results. > > That's RLS kicking in - RLS condition is defined as ((ten

Re: GIST/GIN index not used with Row Level Security

2019-08-13 Thread Derek Hans
> > > What are the RLS policies on the table? > > From select * from pg_policies: "((tenant_name)::name = CURRENT_USER)" > What is the definition of the GIN index? > > CREATE INDEX search__gist ON public.search USING gist (search COLLATE pg_catalog."default" gist_trgm_ops) TABLESPACE

GIST/GIN index not used with Row Level Security

2019-08-13 Thread Derek Hans
When using row level security, GIN and GIST indexes appear to get ignored. Is this expected behavior? Can I change the query to get PostgreSQL using the index? For example, with RLS enabled, this query: select * from search where search like '%yo' Creates this query plan: "Seq Scan on search (co

Re: Update does not move row across foreign partitions in v11

2019-03-04 Thread Derek Hans
Based on a reply to reporting this as a bug, moving rows out of foreign partitions is not yet implemented so this is behaving as expected. There's a mention of this limitation in the Notes section of the Update docs. On Wed, Feb 27, 2019 at 6:12 PM Alvaro Herrera wrote: > On 2019-Feb-2

Re: Update does not move row across foreign partitions in v11

2019-02-27 Thread Derek Hans
s! On Fri, Feb 22, 2019 at 9:44 AM Derek Hans wrote: > I've set up 2 instances of PostgreSQL 11. On instance A, I created a table > with 2 local partitions and 2 partitions on instance B using foreign data > wrappers, following https://pgdash.io/blog/postgres-11-sharding.html. &g

Update does not move row across foreign partitions in v11

2019-02-22 Thread Derek Hans
I've set up 2 instances of PostgreSQL 11. On instance A, I created a table with 2 local partitions and 2 partitions on instance B using foreign data wrappers, following https://pgdash.io/blog/postgres-11-sharding.html. Inserting rows into this table works as expected, with rows ending up in the app