On Tue, Jul 1, 2014 at 10:05 AM, Kevin Grittner <kgri...@ymail.com> wrote: > Tom Lane <t...@sss.pgh.pa.us> wrote: > >> If we're going to do it like this, then I think the force flag >> should be considered to do nothing except override the clock >> check, which probably means it shouldn't be tested in the initial >> if() at all. > > That makes sense, and is easily done.
Attached is the patch to save you a few key strokes :) > The only question left is > how far back to take the patch. I'm inclined to only apply it to > master and 9.4. Does anyone think otherwise? Considering this as a bug-fix, I'd vote for it to be applied to all supported releases. But since this may cause unforeseen performance penalty, I think it should be applied only as far back as the introduction of PGSTAT_STAT_INTERVAL throttle. The throttle was implemeted in 641912b, which AFAICT was part of 8.3. So I guess all the supported releases it is. Best regards, -- Gurjeet Singh http://gurjeet.singh.im/ EDB : www.EnterpriseDB.com : The Enterprise PostgreSQL Company
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 3ab1428..c7f41a5 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -753,7 +753,8 @@ pgstat_report_stat(bool force) /* Don't expend a clock check if nothing to do */ if ((pgStatTabList == NULL || pgStatTabList->tsa_used == 0) && - !have_function_stats && !force) + pgStatXactCommit == 0 && pgStatXactRollback == 0 && + !have_function_stats) return; /* @@ -817,11 +818,11 @@ pgstat_report_stat(bool force) } /* - * Send partial messages. If force is true, make sure that any pending - * xact commit/abort gets counted, even if no table stats to send. + * Send partial messages. Make sure that any pending xact commit/abort + * gets counted, even if there are no table stats to send. */ if (regular_msg.m_nentries > 0 || - (force && (pgStatXactCommit > 0 || pgStatXactRollback > 0))) + pgStatXactCommit > 0 || pgStatXactRollback > 0) pgstat_send_tabstat(®ular_msg); if (shared_msg.m_nentries > 0) pgstat_send_tabstat(&shared_msg);
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers