From: John Lumby <johnlumby@hotmail.com>
To: pgsql general <pgsql-general@postgresql.org>
Subject: REINDEX : new parameter to preserve current average leaf density as new implicit FILLFACTOR
Date: Tue, 25 Jun 2019 21:45:26 +0000
Message-ID: <DM6PR06MB5562CE0EB876CD6C30430D36A3E30@DM6PR06MB5562.namprd06.prod.outlook.com> (raw)
Background : For some workloads involving high volume of INSERT/UPDATE/DELETE, It is sometimes beneficial
to schedule regular REINDEX of high-activity indexes, so as to improve performance, or restore performance levels back to what it was earlier, by removing dead keys etc. This can result in the average page density of these indexes fluctuating up and down in a saw-tooth fashion, REINDEX causing large increase in density (large drop in total number of pages) and the workload gradually decreasing density back to some "steady-state".
Suggestion : it would be useful if REINDEX could , when some new parameter is set , first determine current average leaf page density in the index to be rebuilt, (e.g. the value of pgstatindex().avg_leaf_density from the pgstattuple extension ), and then adopt this density as the temporary override FILLFACTOR while rebuilding index pages, as to to minimize change in density.
This would avoid the saw-tooth effect on number of pages, and also reduce the number of index page-splits which occur during the period immediately following a REINDEX done with default FILLFACTOR of 90%. In effect, it lessens the need for the physical reorganization aspect of REINDEX and focusses more on the function of removing dead keys.
An admin do this for themselves by monitoring index page density and setting the FILLFACTOR to the current density before each REINDEX (and may find that this doesn't change much if the workload is truly steady-state), but I wonder if this community would agree that it would provide a useful automation of the process.
Cheers, John Lumby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: johnlumby@hotmail.com
Subject: Re: REINDEX : new parameter to preserve current average leaf density as new implicit FILLFACTOR
In-Reply-To: <DM6PR06MB5562CE0EB876CD6C30430D36A3E30@DM6PR06MB5562.namprd06.prod.outlook.com>
References: <DM6PR06MB5562CE0EB876CD6C30430D36A3E30@DM6PR06MB5562.namprd06.prod.outlook.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox