Questions tagged [pg-stat-statements]

The pg_stat_statements PostgreSQL module provides a means for tracking execution statistics of all SQL statements executed by a server.

The module must be loaded by adding pg_stat_statements to shared_preload_libraries in postgresql.conf, because it requires additional shared memory. This means that a server restart is needed to add or remove the module.

The pg_stat_statements View
The statistics gathered by the module are made available via a system view named pg_stat_statements. This view contains one row for each distinct query, database ID, and user ID (up to the maximum number of distinct statements that the module can track).

Functions
pg_stat_statements_reset discards all statistics gathered so far by pg_stat_statements. By default, this function can only be executed by superusers.

Full documentation

35 questions
0
votes
1 answer

Why is my "CREATE INDEX CONCURRENTLY .." command blocked by a "SELECT FROM" query? (Postgres 9.6)

I was running a migration to create an index, but the migration was blocked by another query. I resolved the problem after discovering that there was another query blocking my migrations; and after cancelling the blocking query, I was able to…
modulitos
  • 14,737
  • 16
  • 67
  • 110
0
votes
1 answer

How do I use pg_stat_statements extension in greenplum open source version?

I am trying to use a modified greenplum open source version for development. The greenplum version is Greenplum Database 6.0.0-beta.1 build dev (based on PostgreSQL 9.4.24). I wanted to add pg_stat_statements extension to my database, and I did…
0
votes
1 answer

Are times in pg_stat_statements inclusive or exclusive?

I'm trying to profile my requests to PostgreSQL and there are a bunch of PL/pgSQL calls involved as well which in turn they call other functions and run queries. The results provided by pg_stat_statements show very useful data for queries executed…
Mehran
  • 15,593
  • 27
  • 122
  • 221
0
votes
1 answer

Get Full Executed Query in Postgresql

Halo, first, i say thank you for helping me solve my problem before. I'm really newbie using Postgresql. now i have new problem, i do select statement like this one : select * from company where id=10; when i see the query in pg_stat_statements,…
0
votes
1 answer

will db monitoring with pg_stat/pg_statio slow down my other queries?

I recently built a database monitoring plugin for postgresql that queries the pg_stat and pg_statio tables in postgresql. I want to understand/test how my plugin might affect my database but fear that if i just turned my plugin on my database, my…
Dave Lee
  • 205
  • 5
  • 14
1 2
3