Thread: Execution history of a single query

Execution history of a single query

From
arun chirappurath
Date:
Hi All,

From pg_stat_statements we can get the overall execution details of queries.

Can we get the execution details of a single queryid ?

Like today it took 6 seconds,yesterday 5 and so on..just for one query.

Thanks,
Arun

Re: Execution history of a single query

From
Greg Sabino Mullane
Date:
Not directly through pg_stat_statements, no. But you can:

* Use log_min_duration_statement to spy on individual runs
* Periodically copy pg_stat_statements to another table, reset the stats, and then you have some time-based buckets to play with.

Cheers,
Greg

Re: Execution history of a single query

From
Julien Rouhaud
Date:
On Sat, 18 May 2024, 00:42 arun chirappurath, <arunsnmimt@gmail.com> wrote:
Hi All,

From pg_stat_statements we can get the overall execution details of queries.

Can we get the execution details of a single queryid ?

Like today it took 6 seconds,yesterday 5 and so on..just for one query.

you can use PoWA for that: https://powa.readthedocs.io/en/latest/