Re: minimizing pg_stat_statements performance overhead

From: legrand legrand <legrand_legrand(at)hotmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: minimizing pg_stat_statements performance overhead
Date: 2019-03-27 07:47:20
Message-ID: 1553672840401-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
the part that hurts in terms or performances is:

if (jstate.clocations_count > 0)
pgss_store(pstate->p_sourcetext,
query->queryId,
query->stmt_location,
query->stmt_len,
0,
0,
0,
NULL,
&jstate);

that writes the query text to disk, when it has at less one parameter ...
Computing the QueryId should stay very small and can be very usefull when
used in conjonction with
https://www.postgresql-archive.org/Feature-improvement-can-we-add-queryId-for-pg-catalog-pg-stat-activity-view-td6077275.html#a6077602
for wait events sampling.

I would propose to fix this by
if (jstate.clocations_count > 0 && pgss_enabled())
pgss_store(pstate->p_sourcetext,
...

Regards
PAscal

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2019-03-27 07:59:15 Re: [HACKERS] Re: [COMMITTERS] pgsql: Remove pgbench "progress" test pending solution of its timing is (fwd)
Previous Message Kyotaro HORIGUCHI 2019-03-27 07:36:25 Re: shared-memory based stats collector