rows selectivity overestimate for @> operator for arrays

2022-05-27 Thread Alexey Ermakov
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];

Re: How to monitor Postgres real memory usage

2022-05-27 Thread Justin Pryzby
On Sat, May 28, 2022 at 01:40:14AM +0800, 徐志宇徐 wrote: > vm.swappiness=0 I think this is related to the problem. swappiness=0 means to *never* use swap, even if that means that processes are killed. If you really wanted that, you should remove the swap space. Swap is extremely slow and worth avo

Re: rows selectivity overestimate for @> operator for arrays

2022-05-27 Thread Tom Lane
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 *