Re: Higher level questions around shared memory stats

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org, Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, melanieplageman(at)gmail(dot)com
Subject: Re: Higher level questions around shared memory stats
Date: 2022-03-31 00:09:44
Message-ID: 20220331000944.r4dhvqdfmgtv22qs@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-03-30 16:35:50 -0700, Andres Freund wrote:
> On 2022-03-29 12:17:27 -0700, Andres Freund wrote:
> > Separate from the minutia in [1] I'd like to discuss a few questions of more
> > general interest. I'll post another question or two later.
>
> 4) What to do with the stats_temp_directory GUC / PG_STAT_TMP_DIR define /
> pg_stats_temp directory?
>
> With shared memory stats patch, the stats system itself doesn't need it
> anymore. But pg_stat_statements also uses PG_STAT_TMP_DIR to store
> pgss_query_texts.stat. That file can be fairly hot, so there's benefit in
> having something like stats_temp_directory.
>
> I'm inclined to just leave the guc / define / directory around, with a
> note saying that it's just used by extensions?

I had searched before on codesearch.debian.net whether there are external
extensions using it, without finding one (just a copy of pgstat.h). Now I
searched using https://cs.github.com/ ([1]) and found

https://github.com/powa-team/pg_sortstats
https://github.com/uptimejp/sql_firewall
https://github.com/legrandlegrand/pg_stat_sql_plans
https://github.com/ossc-db/pg_store_plans

Which seems to weigh in favor of at least keeping the directory and
define. They all don't seem to use the guc, but just PG_STAT_TMP_DIR.

We currently have code removing files both in pg_stat and the configured
pg_stats_temp directory (defaulting to pg_stat_tmp). All files matching
global.(stat|tmp), db_[0-9]+.(tmp|stat) are removed.

With the shared memory stats patch there's only a single file, so we don't
need that anymore. I guess some extension could rely on files being removed
somehow, but it's hard to believe, because it'd conflict with the stats
collector's files.

Greetings,

Andres Freund

[1] https://cs.github.com/?scopeName=All+repos&scope=&q=PG_STAT_TMP_DIR+NOT+path%3Afilemap.c+NOT+path%3Apgstat.h+NOT+path%3Abasebackup.c+NOT+path%3Apg_stat_statements.c+NOT+path%3Aguc.c

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-03-31 00:26:18 Re: Mingw task for Cirrus CI
Previous Message Tom Lane 2022-03-31 00:01:05 Re: pgsql: Add 'basebackup_to_shell' contrib module.