New SQL counter statistics view (pg_stat_sql) - Mailing list pgsql-hackers

From Haribabu Kommi
Subject New SQL counter statistics view (pg_stat_sql)
Date
Msg-id CAJrrPGeY4xujjoR=z=KoyRMHEK_pSjjp=7VBhOAHq9rfgpV7QQ@mail.gmail.com
Whole thread Raw
Responses Re: New SQL counter statistics view (pg_stat_sql)  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: dsm_unpin_segment
Next
From: Haribabu Kommi
Date:
Subject: Re: Any need of GRANT/REVOKE CREATE TABLE | POLICY | ETC