Re: [GENERAL] pg_stat_statements -- Historical Query

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [GENERAL] pg_stat_statements -- Historical Query
Дата
Msg-id CAB7nPqTVMuDjUqVgYB7xrL7g2nwmcstFfVDGHThjyjiZeF9TiA@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] pg_stat_statements -- Historical Query  (anand086 <anand086@gmail.com>)
Ответы Re: [GENERAL] pg_stat_statements -- Historical Query
Список pgsql-general
On Thu, Aug 10, 2017 at 6:23 AM, anand086 <anand086@gmail.com> wrote:
> I was looking for a way to maintain historical query details in Postgres to
> answer questions like
>
> What was the sql call rate between time X and Y?
> Did the execution count increase for the query increase between time X and
> Y?
> In past 10mins what all queries were run in the db?
>
> and few others like this.
>
> What would be best way to do it? Any thoughts?

pg_stat_statements has a function allowing to reset what the view
pg_stat_statements holds as information. You could copy periodically
the data of pg_stat_statements and then invoke
pg_stat_statements_reset to put everything back to zero. Then you
would just need to do your analysis work based on the amount of data
copied into your custom table.
--
Michael


В списке pgsql-general по дате отправления:

Предыдущее
От: anand086
Дата:
Сообщение: [GENERAL] pg_stat_statements -- Historical Query
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: [GENERAL] pg_stat_statements -- Historical Query