Re: [RFC] [PATCH] Flexible "partition pruning" hook

From: Andres Freund <andres(at)anarazel(dot)de>
To: Mike Palmiotto <mike(dot)palmiotto(at)crunchydata(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [RFC] [PATCH] Flexible "partition pruning" hook
Date: 2019-04-06 02:06:34
Message-ID: 20190406020634.gdsijiehq6wtmkc7@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2019-02-28 13:36:32 -0500, Mike Palmiotto wrote:
> On Wed, Feb 27, 2019 at 12:36 PM Peter Eisentraut
> <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> > <snip>
> > To rephrase this: You have a partitioned table, and you have a RLS
> > policy that hides certain rows, and you know based on your business
> > logic that under certain circumstances entire partitions will be hidden,
> > so they don't need to be scanned. So you want a planner hook that would
> > allow you to prune those partitions manually.
> >
> > That sounds pretty hackish to me. We should give the planner and
> > executor the appropriate information to make these decisions, like an
> > additional partition constraint.
>
> Are you thinking of a partition pruning step for FuncExpr's or
> something else? I was considering an implementation where FuncExpr's
> were marked for execution-time pruning, but wanted to see if this
> patch got any traction first.
>
> > If this information is hidden in
> > user-defined functions in a way that cannot be reasoned about, who is
> > enforcing these constraints and how do we know they are actually correct?
>
> The author of the extension which utilizes the hook would have to be
> sure they use the hook correctly. This is not a new or different
> concept to any other existing hook. This hook in particular would be
> used by security extensions that have some understanding of the
> underlying security model being implemented by RLS.

I noticed that the CF entry for this patch is marked as targeting
v12. Even if we had agreement on the design - which we pretty clearly
don't - I don't see that being realistic for a patch submitted a few
days before the final v12 CF. That really only should contain simple new
patches, or, obviously, patches that have been longer in development.

I've moved this to the next CF, and marked it as targeting v13.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-04-06 02:15:48 Re: 2019-03 Starts Tomorrow
Previous Message GUO Rui 2019-04-06 01:38:09 Re: Google Summer of Code: question about GiST API advancement project