New SQL counter statistics view (pg_stat_sql)

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: New SQL counter statistics view (pg_stat_sql)
Date: 2016-08-20 12:21:36
Message-ID: CAJrrPGeY4xujjoR=z=KoyRMHEK_pSjjp=7VBhOAHq9rfgpV7QQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This is a new statistics view that is used to provide the number of
SQL operations that are
happened on a particular interval of time. This view is useful for the
system to find out the
pattern of the operations that are happening in the instance during
particular interval of
time.

Following is the more or less columns and their details of the pg_stat_sql view.

postgres=# \d pg_stat_sql
View "pg_catalog.pg_stat_sql"
Column | Type | Modifiers
-------------+--------------------------+-----------
selects | bigint |
inserts | bigint |
deletes | bigint |
updates | bigint |
declares | bigint |
fetches | bigint |
copies | bigint |
reindexes | bigint |
truncates | bigint |
stats_reset | timestamp with time zone |

The SQL counters gets updated only for the external SQL queries, not for
the SQL queries that are generated internally. The counters gets updated
at exec_simple_query and exec_execute_message functions.

User can reset the SQL counter statistics using an exposed function.
The Stats collection can be turned on/off using a GUC also.

Any comments/objections in providing a patch for the same?

Regards,
Hari Babu
Fujitsu Australia

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2016-08-20 12:39:39 Re: Any need of GRANT/REVOKE CREATE TABLE | POLICY | ETC
Previous Message Amit Kapila 2016-08-20 11:37:43 Re: dsm_unpin_segment