Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Julien Rouhaud <rjuju123@gmail.com>
From: Julien Rouhaud <rjuju123@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Andrei Zubkov <zubkov@moonset.ru>, Greg Stark <stark@mit.edu>, "Anton A. Melnikov" <aamelnikov@inbox.ru>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-04-02T07:24:56Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Improve quoting in some error messages
- 07e5e6674233 14.0 cited
On Fri, Apr 01, 2022 at 01:01:53PM -0700, Andres Freund wrote:
> Hi,
>
> On 2022-04-01 22:47:02 +0300, Andrei Zubkov wrote:
> > + entry = (pgssEntry *) hash_search(pgss_hash, &key, HASH_FIND, NULL);
> > +
> > + if (entry) {
> > + /* Found */
> > + if (minmax_only) {
> > + /* When requested reset only min/max statistics of an entry */
> > + entry_counters = &entry->counters;
> > + for (int kind = 0; kind < PGSS_NUMKIND; kind++)
> > + {
> > + entry_counters->max_time[kind] = 0;
> > + entry_counters->min_time[kind] = 0;
> > + }
> > + entry->minmax_stats_since = stats_reset;
> > + }
> > + else
> > + {
> > + /* Remove the key otherwise */
> > + hash_search(pgss_hash, &entry->key, HASH_REMOVE, NULL);
> > + num_remove++;
> > + }
> > + }
>
> It seems decidedly not great to have four copies of this code. It was already
> not great before, but this patch makes the duplicated section go from four
> lines to 20 or so.
+1