Re: query execution time for last 24 hours in PostgreSQL

From: SOzcn <selahattinozcnma(at)gmail(dot)com>
To: nikhil kumar <nikhil(dot)dba97(at)gmail(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: query execution time for last 24 hours in PostgreSQL
Date: 2024-05-23 18:25:21
Message-ID: CAJyV5AZOhULqaFVoAxEQ4ix2aEvbDGUzYeCYk8JtGX62b98jTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello,

you can get this infos with pg_stat_statement extension.

https://www.postgresql.org/docs/current/pgstatstatements.html

nikhil kumar <nikhil(dot)dba97(at)gmail(dot)com>, 23 May 2024 Per, 21:08 tarihinde
şunu yazdı:

> Hi Team,
>
> Can you please let me know anyone how to get each query execution time
> from last 24 hours in PostgreSQL
>
> I tried the below query but giving the wrong information.
>
> SELECT sa.client_addr,
> sa.usename,
> sa.datname,
> sa.state,
> sa.query,
> sa.query_start,
> EXTRACT (EPOCH FROM (current_timestamp sa.query_start)) AS
> execution_time_seconds
> FROM pg_stat_activity sa
> WHERE sa.query_start >= current_timestamp interval '24 hours';
>
> Thanks,
> Nikhil,
> PostgreSQL DBA,
> 8074430856.
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Holger Jakobs 2024-05-23 19:05:13 Re: query execution time for last 24 hours in PostgreSQL
Previous Message nikhil kumar 2024-05-23 18:07:42 query execution time for last 24 hours in PostgreSQL