On Fri, May 27, 2022 at 12:19 PM Alexey Ermakov <
alexey.erma...@dataegret.com> wrote:
> Hello, please look into following example:
>
> postgres=# create table test_array_selectivity as select
> array[id]::int[] as a from generate_series(1, 1000) gs(id);
> SELECT 1000
> postgres=# explain
Alexey Ermakov writes:
> so if we store mostly one element in array and they're almost all
> distinct then in tables with more then stats_target/0.0063 (~1.58M for
> maximum stats target 1) rows we'll get 0.005 constant for selectivity.
Yeah. There's a comment in array_selfuncs.c about
Hello, please look into following example:
postgres=# create table test_array_selectivity as select
array[id]::int[] as a from generate_series(1, 1000) gs(id);
SELECT 1000
postgres=# explain analyze select * from test_array_selectivity where a
@> array[1];