Re: [HACKERS] Planning counters in pg_stat_statements

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Planning counters in pg_stat_statements
Дата
Msg-id 31461.1515806185@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Planning counters in pg_stat_statements  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] Planning counters in pg_stat_statements  (Thomas Munro <thomas.munro@enterprisedb.com>)
Список pgsql-hackers
I wrote:
> Haribabu Kommi <kommi.haribabu@gmail.com> writes:
>> I checked the latest patch and it is working fine and I don't have any
>> further comments. Marked the patch as "ready for committer".

> I started to look at this patch,

... looking further, I'm really seriously unhappy about this bit:

@@ -943,9 +1006,16 @@ pgss_ExecutorEnd(QueryDesc *queryDesc)
...
+
+        /*
+         * Clear planning_time, so that we only count it once for each
+         * replanning of a prepared statement.
+         */
+        queryDesc->plannedstmt->planning_time = 0;
     }

What we have here is pgss_ExecutorEnd stomping on the plan cache.
I do *not* find that acceptable.  At the very least, it ruins the
theory that this field is a shared resource.

What we could/should do instead, I think, is have pgss_planner_hook
make its own pgss_store() call to log the planning time results
(which would mean we don't need the added PlannedStmt field at all).
That would increase the overhead of this feature, which might mean
that it'd be worth having a pg_stat_statements GUC to enable it.
But it'd be a whole lot cleaner.

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Planning counters in pg_stat_statements
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()