On Thu, Apr 4, 2019 at 2:52 PM Julien Rouhaud <rjuju...@gmail.com> wrote:

> On Thu, Apr 4, 2019 at 1:25 PM Magnus Hagander <mag...@hagander.net>
> wrote:
> >
> > On Thu, Apr 4, 2019 at 10:47 AM Julien Rouhaud <rjuju...@gmail.com>
> wrote:
> >>
> >> Actually we do track counters for shared relations (see
> >> pgstat_report_stat), we just don't expose them in any view.  But it's
> >> still possible to get the counters manually:
> >>
> >> # select pg_stat_get_db_blocks_hit(0);
> >>  pg_stat_get_db_blocks_hit
> >> ---------------------------
> >>                    2710329
> >> (1 row)
> >
> >
> > Oh, right, we do actually collect it, we just don't show is. So that's
> another argument *for* having it in pg_stat_database. Or at least not for
> having it in a checksum specific view, because then we should really make a
> separate view for this as well.
>
> Ok, so let's expose all the shared counters in pg_stat_database and
> remove the pg_stat_checksum view.
>
> >> My main concern is that pg_stat_get_db_numbackends(0) report something
> >> like the total number of backend (though it seems that there's an
> >> extra connection accounted for, I don't know which process it's), so
> >> if we expose it in pg_stat_database, sum(numbackends) won't make sense
> >> anymore.
> >
> > We could also just hardcoded it so that one always shows 0?
>
> That's a bit hacky, but that's probably the best compromise.  Attached
> v4 with all those changes.
>

I'm not sure I like the idea of using "<shared_objects>" as the database
name. It's not very likely that somebody would be using that as a name for
their database, but i's not impossible. But it also just looks strrange.
Wouldn't NULL be a more appropriate choice?

Likewise, shouldn't we return NULL as the number of backends for the shared
counters, rather than 0?

Micro-nit:
+     <entry>Time at which the last data page checksum failures was
detected in
s/failures/failure/

-- 
 Magnus Hagander
 Me: https://www.hagander.net/ <http://www.hagander.net/>
 Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>

Reply via email to