RE: [HACKERS] Cached plans and statement generalization

From: "Yamaji, Ryo" <yamaji(dot)ryo(at)jp(dot)fujitsu(dot)com>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: [HACKERS] Cached plans and statement generalization
Date: 2018-08-02 05:25:53
Message-ID: 9A6E5062D5D4DB458C80C2B2920BD71D5C471C@g01jpexmbkw23
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Konstantin Knizhnik [mailto:k(dot)knizhnik(at)postgrespro(dot)ru]
> Sent: Wednesday, August 1, 2018 4:53 PM
> To: Yamaji, Ryo/山地 亮 <yamaji(dot)ryo(at)jp(dot)fujitsu(dot)com>
> Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
> Subject: Re: [HACKERS] Cached plans and statement generalization
>
> 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?

I checked not CacheMemoryContext but "plan cache context".
Because I think that the memory context that autoprepare mainly uses is "plan cache context".

Non-default configuration parameter was used as well as Konstantin.
autoprepare_limit=1
autoprepare_threshold=1

The procedure of the test that I did is shown below.

create dummy database
create table test (key1 integer, key2 integer, ... , key100 integer);
insert into test values (1, 2, ... , 100);

And, different queries are executed.
select key1 from test where key1=1 and key2=2 and ... and key100=100;
select key2 from test where key1=1 and key2=2 and ... and key100=100;
select key3 from test where key1=1 and key2=2 and ... and key100=100;...

And, "plan cache context" was confirmed by using gdb.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2018-08-02 05:59:38 Re: Have an encrypted pgpass file
Previous Message Peter Geoghegan 2018-08-02 04:59:48 Re: Making all nbtree entries unique by having heap TIDs participate in comparisons