Re: Enable pg_stat_statements extension for limited statements only - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Enable pg_stat_statements extension for limited statements only
Date
Msg-id 1434937.1669832104@sss.pgh.pa.us
Whole thread Raw
In response to Enable pg_stat_statements extension for limited statements only  (Sayyid Ali Sajjad Rizavi <sasrizavi@gmail.com>)
Responses Re: Enable pg_stat_statements extension for limited statements only
List pgsql-hackers
Sayyid Ali Sajjad Rizavi <sasrizavi@gmail.com> writes:
> Hi, I'd like to propose a change and get advice if I should work on it.
> The extension pg_stat_statements is very helpful, but the downside is that
> it will take up too much disk space when storing query stats if it's
> enabled for all statements like SELECT, INSERT, UPDATE, DELETE.

It will only take up a lot of disk space if you let it, by setting
the pg_stat_statements.max parameter too high.

> For example, deletes do not happen too frequently; so I'd like to be able
> to enable pg_stat_statements only for the DELETE statement, maybe using
> some flags.

I'm a little skeptical of the value of that.  Why would you want stats
only for infrequent statements?

I'm not denying that there might be usefulness in filtering what
pg_stat_statements will track, but it's not clear to me that
this particular proposal will be useful to many people.

I wonder whether there would be more use in filters expressed
as regular expressions to match against the statement text.
That would allow, for example, tracking statements that mention
a particular table as well as statements with a particular
head keyword.  I could see usefulness in both a positive filter
(must match this to get tracked) and a negative one (must not
match this to get tracked).

            regards, tom lane



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: generic plans and "initial" pruning
Next
From: "Daniel Verite"
Date:
Subject: Re: Tests for psql \g and \o