On Thu, Apr 4, 2019 at 10:25 AM Magnus Hagander <mag...@hagander.net> wrote: > > On Thu, Apr 4, 2019 at 6:22 AM Michael Paquier <mich...@paquier.xyz> wrote: >> >> On Wed, Apr 03, 2019 at 11:56:14AM +0200, Julien Rouhaud wrote: >> > But there's still the problem of reporting errors on shared relation, >> > so pg_stat_database doesn't really fit for that. If we go with a >> > checksum centric view, it'd be strange to have some of the counters in >> > another view. >> >> Having pg_stat_database filled with a phantom row full of NULLs to >> track checksum failures of shared objects would be confusing I think. >> I personally quite like the separate view approach, with one row per >> database, but one opinion does not stand as an agreement. > > It wouldn't be just that, but it would make sense to include things like > blks_read/blks_hit there as well, wouldn't it? As well as read/write time. > Things we don't track today, but it could be useful to do so.
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) 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. >> Anyway, even if we have no agreement on the shape of what we'd like to >> do, I don't think that HEAD is in a proper shape now because we just >> don't track a portion of the objects which could have checksum >> failures. So we should either revert the patch currently committed, >> or add tracking for shared objects, but definitely not keep the code >> in a state in-between. > > > Definitely. That's why we're discussing it now :) Maybe we should put it on > the open items list, because we definitely don't want to ship it one way and > then change our mind in the next version. I already added an open item for that.