On 31.07.2018 12:12, Yamaji, Ryo wrote:
>
> 3. I confirmed the transition of the amount of the memory when it tried to prepare query
> of the number that exceeded the value specified for autoprepare_limit.
> [autoprepare_limit=1 and execute 10 different queries]
> plan cache context: 1032 used
> plan cache context: 39832 used
> plan cache context: 78552 used
> plan cache context: 117272 used
> plan cache context: 155952 used
> plan cache context: 194632 used
> plan cache context: 233312 used
> plan cache context: 272032 used
> plan cache context: 310712 used
> plan cache context: 349392 used
> plan cache context: 388072 used
>
> I feel the doubt in an increase of the memory utilization when I execute a lot of
> query though cached query is one (autoprepare_limit=1).
> This behavior is correct?
I failed to reproduce the problem.
I used the following non-default configuration parameters:
autoprepare_limit=1
autoprepare_threshold=1
create dummy database:
create table foo(x integer primary key, y integer);
insert into foo values (generate_series(1,10000), 0);
and run different queries, like:
postgres=# select * from foo where x=1;
postgres=# select * from foo where x+x=1;
postgres=# select * from foo where x+x+x=1;
postgres=# select * from foo where x+x+x+x=1;
...
and check size of CacheMemoryContext using gdb - it is not increased.
Can you please send me your test?