Subject: Execution history of a single query

From: arun chirappurath <[email-masked]>
Date: Fri, 17 May 2024 22:12:14 +0530

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

---

From: Greg Sabino Mullane <[email-masked]>
Date: Fri, 17 May 2024 13:23:09 -0400

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

---

From: Julien Rouhaud <[email-masked]>
Date: Sat, 18 May 2024 07:05:51 +0800

> 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/