Thank you for your response, Konstantin

I think we cannot just turn this optimization
>
Of course not, that is the reason why I started this thread.

org.apache.ignite.internal.processors.query.h2.opt.GridH2Table don't change
> it neither on remove or update


 Yes, but we can increment this counter and find possible workarounds.

 It should be benchmarked first.
>
Absolutelly agree.

I started this thread to discuss possible caveats and traps and decide
whether to implement this optimization or not.
If there is too many traps or moreover this is impossible or SQL
maintainers are against this, then it's probably not worth to do it.



ср, 22 апр. 2020 г. в 09:52, Konstantin Orlov <kor...@gridgain.com>:

> Hello, Ivan
>
> I think we cannot just turn this optimization on because a result
> invalidation counts on org.h2.engine.Database#modificationDataId (see
> org.h2.command.dml.Query#sameResultAsLast(Session, Value[], Value[],
> long)), but org.apache.ignite.internal.processors.query.h2.opt.GridH2Table
> don't change it neither on remove or update. And incrementing
> org.h2.engine.Database#modificationDataId on each data update may lead to
> some performance issues. It should be benchmarked first.
>
> --
> Regards,
> Konstantin Orlov
>
>
> > On 21 Apr 2020, at 14:51, Ivan Daschinskiy <ivanda...@gmail.com> wrote:
> >
> > Hello folks.
> >
> > Recently I trying to investigate why when the query, i.e. «SELECT * FROM
> T1 WHERE ID IN (SELECT T1_ID FROM T2), is executed locally,
> > subquery evaluated, even if result is the same. I noticed, that in
> mentioned in subj (.ConnectionManager#DEFAULT_DB_OPTIONS),
> > parameter OPTIMIZE_REUSE_RESULT explicitly set to 0. This value disable
> internal H2 optimization (see details here
> org.h2.command.dml.Query#query(int, org.h2.result.ResultTarget) and lead
> the mentioned above query to be ineffective.
> >
> > I cannot understand why this decision was made. Also I don’t find any
> evidence that setting OPTIMIZE_REUSE_RESULT to 1 could break something.
> Unfortunatelly, it is impossible to change this behavior per Session
> without forking H2, because this flag is set in org.h2.engine.Database.
> >
> > Let’s discuss possible caveats in enabling this optimization by default
> in DEFAULT_DB_OPTIONS.
> >
>
>

-- 
Sincerely yours, Ivan Daschinskiy

Reply via email to