Re: pgstats_initstats() cost - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pgstats_initstats() cost
Date
Msg-id 6782.1060701568@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgstats_initstats() cost  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I said:
> I doubt a hash is worth maintaining, because the active tabstat entries
> should only be for tables that are being touched in the current command
> (thus, there are not more than six in your example).  I'm not sure why
> it takes so much time to look through six entries though ...

I replicated your example, and soon found that in fact there were
forty-three active tabstat slots, which makes pgstat_initstats a little
bit more credible as a time-waster.

The reason why there were forty-three, in a statement that's only
touching one relation, is that with the present coding of pgstats,
if you have stats gathering off then there will be an active entry
for every relation that's been touched since backend launch.
pgstat_report_tabstat() should have flushed the entries, but
*if reporting is disabled then it fails to do so*.

This is clearly a bug.  Will fix.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: reuse sysids security hole?
Next
From: Andrew Dunstan
Date:
Subject: Re: reuse sysids security hole?