|From:||Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>|
|To:||Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>|
|Cc:||Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>|
|Subject:||Re: Push down time-related SQLValue functions to foreign server|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
Tom Lane писал 2022-01-18 23:01:
> I wrote:
>> Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru> writes:
>>> This means we'll translate something like
>>> explain select * from t where d > now() - '1 day'::interval;
>>> select * from t where d > $1;
> After thinking about that a bit more, I see that this will result
> in a major redefinition of what is "shippable". Right now, we do not
> consider the above WHERE clause to be shippable, not only because of
> now() but because the timestamptz-minus-interval operator is dependent
> on the timezone setting, which might be different at the remote.
> But if we evaluate that operator locally and send its result as a
> parameter, the objection vanishes. In fact, I don't think we even
> need to require the subexpression to contain only built-in functions.
> Its result still has to be of a built-in type, but that's a much
> weaker restriction.
So far I have the following prototype. It seems to be working, but I
think it can be enhanced.
At least, some sort of caching seems to be necessary for
1) Now expression can be either 'stable shippable' or 'shippable
according to old rules'. We check if it's 'stable shippable' in
is_foreign_param() and deparseExpr(). All such exprs are replaced by
params while deparsing.
2) contain_mutable_functions() now is calculated only for current node,
if node is not considered 'stable shippable'.
Is it step in the right direction or do I miss something?
|Next Message||Robert Haas||2022-01-20 14:02:46||Re: removing datlastsysoid|
|Previous Message||Amit Kapila||2022-01-20 13:33:27||Re: row filtering for logical replication|