BUG #15372: pg_stat_statements extension ignore stats_temp_directory setting and always write into pg_stat_tmp

Started by PG Bug reporting formover 7 years ago2 messagesbugs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following bug has been logged on the website:

Bug reference: 15372
Logged by: Maxim Boguk
Email address: maxim.boguk@gmail.com
PostgreSQL version: 9.6.10
Operating system: Linux
Description:

Hi,

pg_stat_statements extension always write pgss_query_texts.stat file into
data_directory/pg_stat_tmp
and ignore stats_temp_directory settings which supposed to overwrite stat
directory location.
It isn't good because this file could be quite a large (and almost always
larger than standard pg_stat_tmp content).

It seems that the issue exists in any supported version of the database.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: BUG #15372: pg_stat_statements extension ignore stats_temp_directory setting and always write into pg_stat_tmp

=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:

pg_stat_statements extension always write pgss_query_texts.stat file into
data_directory/pg_stat_tmp
and ignore stats_temp_directory settings which supposed to overwrite stat
directory location.

This is operating as designed, see comment in pg_stat_statements.c:

/*
* Location of external query text file. We don't keep it in the core
* system's stats_temp_directory. The core system can safely use that GUC
* setting, because the statistics collector temp file paths are set only once
* as part of changing the GUC, but pg_stat_statements has no way of avoiding
* race conditions. Besides, we only expect modest, infrequent I/O for query
* strings, so placing the file on a faster filesystem is not compelling.
*/
#define PGSS_TEXT_FILE PG_STAT_TMP_DIR "/pgss_query_texts.stat"

regards, tom lane