Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query
Дата
Msg-id CAA4eK1J3QVi9Q_tgZiN9Fua00kTA-h+0Osjj5HbsdzVDHH1F2g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query  (Haribabu Kommi <kommi.haribabu@gmail.com>)
Список pgsql-hackers
On Sat, Nov 17, 2018 at 4:47 AM Haribabu Kommi <kommi.haribabu@gmail.com> wrote:
>
> With the above query to get the queryid, but there are no such queries
> present in the pg_stat_statements, so the above query returns NULL as
> output, and with NULL as input to the _reset() function, it takes the default
> value of 0, and the reset query compares with rest of the two parameters
> of userid and dbid. There is only one query that is present with that
> combination, and that query is deleted.
>
> In order to avoid such wrong results, i moved this as the first reset query,
> so that there will be many queries that satisfy the condition in case if such
> mistakes happens.
>

Okay, that makes sense.

+--
+-- remove query ('SELECT $1 AS "ONE"') executed by two users
+--
+SELECT pg_stat_statements_reset(NULL,NULL,s.queryid)
+ FROM pg_stat_statements AS s WHERE s.query = 'SELECT $1 AS "ONE"' LIMIT 1;

In the above query, I don't see any advantage of adding LIMIT 1, so
removed in the attached patch.  I have also written a commit message
based on what you have written, kindly see if that looks okay to you
especially the credits section.

I am happy with the attached patch and will commit the same by
Wednesday if you or others don't have any further comments.

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Вложения

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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Early WIP/PoC for inlining CTEs
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: zheap: a new storage format for PostgreSQL