> This test was to catch a crash that was happening in older version of
> the patch, so it doesn't have to verify the actual pgss entry.

It seems odd to keep this test because of crash behavior experienced
in a previous version of the patch. if the crash reason was understood
and resolved, why keep it?

> > 2/ Looking at IsMergeableConst, I am not sure why we care about
> > things like function volatility, implicit cast or funcid > 
> > FirstGenbkiObjectId?
>
> Function volatility is important to establish how constant is the
> result, for now we would like to exclude not immutable functions. The
> implicit cast and builtin check are there to limit squashing and exclude
> explicit or user-created functions (the second is probably an overkill,
> but this could be gradually relatex later). Or are you not sure about
> something different?

My thoughts are when dealing with FuncExpr, if the first arg in the list of
func->args is a Const, shouldn't that be enough to tell us that we have
a mergeable value. If it's not a Const, it may be another FuncExpr, so
that tells us we don't have a mergeable list. Why would this not be enough?

See the attached 0001-experiement-on-top-of-v27.patch
which applies on top of v27 and produces the results like below.

postgres=# explain verbose select from test_merge where id in (1, 2,
3, 4, 5, 6::bigint);
                            QUERY PLAN
-------------------------------------------------------------------
 Seq Scan on public.test_merge  (cost=0.00..49.55 rows=68 width=0)
   Filter: (test_merge.id = ANY ('{1,2,3,4,5,6}'::bigint[]))
 Query Identifier: 9190277587190463639
(3 rows)

postgres=# explain verbose select from test_merge where id in (1, 2,
3, 4, 5, 6::bigint, 7);
                            QUERY PLAN
-------------------------------------------------------------------
 Seq Scan on public.test_merge  (cost=0.00..52.38 rows=79 width=0)
   Filter: (test_merge.id = ANY ('{1,2,3,4,5,6,7}'::bigint[]))
 Query Identifier: 9190277587190463639
(3 rows)

postgres=# explain verbose select from test_merge where id in (1, 2,
3, 4, 5, 6::bigint, 7, testf5(1));

QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------
 Seq Scan on public.test_merge  (cost=0.00..625.85 rows=90 width=0)
   Filter: (test_merge.id = ANY (ARRAY['1'::bigint, '2'::bigint,
'3'::bigint, '4'::bigint, '5'::bigint, '6'::bigint, '7'::bigint,
(testf5(1))::bigint]))
 Query Identifier: 4874022288496461916
(3 rows)

--

Sami

Attachment: 0001-experiement-on-top-of-v27.patch
Description: Binary data

Reply via email to