Re: [PATCH] Statistics collection for CLUSTER command

From: Noah Misch <noah(at)leadboat(dot)com>
To: Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>
Cc: Satoshi Nagayasu <snaga(at)uptime(dot)jp>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Statistics collection for CLUSTER command
Date: 2013-10-20 05:37:02
Message-ID: 20131020053702.GA383291@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > (2013/08/08 20:52), Vik Fearing wrote:
> >> As part of routine maintenance monitoring, it is interesting for us to
> >> have statistics on the CLUSTER command (timestamp of last run, and
> >> number of runs since stat reset) like we have for (auto)ANALYZE and
> >> (auto)VACUUM. Patch against today's HEAD attached.

Adding new fields to PgStat_StatTabEntry imposes a substantial distributed
cost, because every database stats file write-out grows by the width of those
fields times the number of tables in the database. Associated costs have been
and continue to be a pain point with large table counts:

http://www.postgresql.org/message-id/flat/1718942738eb65c8407fcd864883f4c8(at)fuzzy(dot)cz
http://www.postgresql.org/message-id/flat/52268887(dot)9010509(at)uptime(dot)jp

In that light, I can't justify widening PgStat_StatTabEntry by 9.5% for this.
I recommend satisfying this monitoring need in your application by creating a
cluster_table wrapper function that issues CLUSTER and then updates statistics
you store in an ordinary table. Issue all routine CLUSTERs by way of that
wrapper function. A backend change that would help here is to extend event
triggers to cover the CLUSTER command, permitting you to inject monitoring
after plain CLUSTER and dispense with the wrapper.

Thanks,
nm

--
Noah Misch
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2013-10-20 06:35:59 Re: Heavily modified big table bloat even in auto vacuum is running
Previous Message Amit Kapila 2013-10-20 04:29:49 Re: Patch for reserved connections for replication users