Re: [HACKERS] Improve perfomance for index search ANY(ARRAY[]) condition with single item - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Improve perfomance for index search ANY(ARRAY[]) condition with single item
Date
Msg-id 12103.1500828947@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] Improve perfomance for index search ANY(ARRAY[]) condition withsingle item  (Dima Pavlov <imyfess@gmail.com>)
Responses Re: [HACKERS] Improve perfomance for index search ANY(ARRAY[]) condition with single item
List pgsql-hackers
Dima Pavlov <imyfess@gmail.com> writes:
> The problem was discussed on stackoverflow:
> https://stackoverflow.com/questions/45061966/index-usage-with-single-item-anyarray

Usually, we're not very happy with submissions that reference external
pages for justification; we like to have all the relevant material in our
mail archives.

> That's my first patch so I will be grateful for constructive criticism.

I think it would be better to do this in the planner, see specifically
eval_const_expressions.  That would allow the transformation to succeed
in more cases, like where the array is coming from a parameter rather
than an ARRAY[] construct.  That is, you should be able to do this not
only for ARRAY[x] but for any single-element constant array.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Testlib.pm vs msys
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Improve perfomance for index search ANY(ARRAY[]) condition with single item