View Issue Details

IDProjectCategoryView StatusLast Update
0000550Pgpool-IIGeneralpublic2019-10-16 12:37
Reportergsl23 Assigned Topengbo  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionopen 
PlatformlinuxOSredhatOS Version7
Product Version3.7.3 
Summary0000550: Pgpool system queries
DescriptionHi friends ! (and sorry for may bad english)

We observe some load on db generated by queries :
"SELECT count(*) FROM pg_class AS c, pg_namespace AS n WHERE c.oid = pg_catalog.to_regclass(?) AND c.relnamespace = n.oid AND n.nspname = ?"
"SELECT current_setting(?)"

We can't find thoese statements anywhere in code, but I find first query in https://github.com/pgpool/pgpool2/blob/master/src/utils/pool_select_walker.c

Why pgpool so frequently query this statements and how to minimize it ?

Config + stat data about this queries in attachments.
TagsNo tags attached.

Activities

gsl23

2019-10-07 20:35

reporter  

pgpool.conf (2,303 bytes)
high_sql_data-1570447913732.txt (14,137 bytes)   
high_sql_data-1570447913732.txt (14,137 bytes)   
high_sql1.JPG (59,282 bytes)   
high_sql1.JPG (59,282 bytes)   
high_sql2.JPG (65,087 bytes)   
high_sql2.JPG (65,087 bytes)   

pengbo

2019-10-08 10:37

developer   ~0002910

> Why pgpool so frequently query this statements and how to minimize it ?

When Pgpool-II receives a client query, Pgpool-II need to inquiry PostgreSQL's system catalogs to determine that
- if a table in client's query is a temporary table or not
- if a table in client's query is an unlogged table or not
- if a function in client's query is "immutable" or not

Because such client's queries should be sent to PostgreSQL primary server only.
So, Pgpool-II issues queries to PostgreSQL's system catalogs, when a table or function appears in client's query.

However, this behaviour is improved in the coming major release Pgpool-II 4.1.
In 4.1 new parameter "enable_shared_relcache" is added.
If enable_shared_relcache is on, the relation stored in memory cache can be shared among Pgpool-II child processes.
This feature can reduce the queries issued to PostgreSQL's system catalogs.

gsl23

2019-10-08 15:10

reporter   ~0002913

Thx, pengbo

Issue History

Date Modified Username Field Change
2019-10-07 20:35 gsl23 New Issue
2019-10-07 20:35 gsl23 File Added: pgpool.conf
2019-10-07 20:35 gsl23 File Added: high_sql_data-1570447913732.txt
2019-10-07 20:35 gsl23 File Added: high_sql1.JPG
2019-10-07 20:35 gsl23 File Added: high_sql2.JPG
2019-10-08 10:18 pengbo Status new => assigned
2019-10-08 10:37 pengbo Note Added: 0002910
2019-10-08 10:38 pengbo Assigned To => pengbo
2019-10-08 10:38 pengbo Status assigned => feedback
2019-10-08 15:10 gsl23 Note Added: 0002913
2019-10-08 15:10 gsl23 Status feedback => assigned
2019-10-16 12:37 pengbo Status assigned => closed