Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

find TOP 10 Long Running Queries using pg_stat_statements

This is the second day with the PostgreSQL pg_stat_statements module.
In the previous post, I have shared basic steps to configure and enable pg_stat_statements module for tracking query statistics.

In this post, I have prepared one small DBA script to find query statistics such a way that we can easily see the long executed queries.

The PostgreSQL database administrator can use this script for investigating performance related issues.
 ,pss.query AS SQLQuery
 ,pss.rows AS TotalRowCount
 ,(pss.total_time / 1000 / 60) AS TotalMinute 
 ,((pss.total_time / 1000 / 60)/calls) as TotalAverageTime  
FROM pg_stat_statements AS pss
INNER JOIN pg_database AS pd
 ON pss.dbid=pd.oid


Popular posts from this blog

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

spfile and pfile errors

2017 Shortern URL - Other Website Like ADFOC.US

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated ORA-01262: Stat failed on a file destination directory Linux-x86_64 Error: 2: No such file or directory