Re: inconsistent results querying table partitioned by date

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Alan Jackson <ajax(at)tvsquared(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: inconsistent results querying table partitioned by date
Date: 2019-05-16 01:51:05
Message-ID: ad3e1d3b-392c-d336-5bf1-256682874a9d@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2019/05/16 10:00, David Rowley wrote:
> On Thu, 16 May 2019 at 12:28, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> The loop over steps, per se, isn't that expensive --- but extra syscache
>> lookups are. Or at least that's my gut feeling about it. If we just had
>> match_clause_to_partition_key mark the steps as being plan-time executable
>> or not, we could avoid the repeat lookup.
>
> okay, on re-think. I'm a little unsure of if you're mixing up "extra"
> and "repeat", we do need an "extra" lookup because we've discovered
> that strict ops are not safe to use during planning. I can't see
> around having this extra call. If you mean it's a repeat call, then
> it's really not, as we only do the op_volatile() check with
> forplanner=true. With forplanner = false we only call
> contain_var_clause() and contain_volatile_functions().

How about we add one more bool, say, runtime_pruning_needed to
GeneratePruningStepsContext and set it when we discover in
match_clause_to_partition_key() that runtime pruning will be needed? Then
return it to make_partitionedrel_pruneinfo() using a new output parameter
of gen_partprune_steps()?

Thanks,
Amit

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-05-16 02:19:03 Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND
Previous Message Michael Paquier 2019-05-16 01:38:08 Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND