Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hftQX-0004VY-8n for pgsql-general@arkaria.postgresql.org; Tue, 25 Jun 2019 21:56:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hftQV-0005Aa-UZ for pgsql-general@arkaria.postgresql.org; Tue, 25 Jun 2019 21:56:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hftQV-0005AT-HP for pgsql-general@lists.postgresql.org; Tue, 25 Jun 2019 21:56:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hftQT-00023W-BD for pgsql-general@postgresql.org; Tue, 25 Jun 2019 21:56:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x5PLuOmM029177; Tue, 25 Jun 2019 17:56:24 -0400 From: Tom Lane To: John Lumby cc: pgsql general Subject: Re: REINDEX : new parameter to preserve current average leaf density as new implicit FILLFACTOR In-reply-to: References: Comments: In-reply-to John Lumby message dated "Tue, 25 Jun 2019 21:45:26 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <29175.1561499784.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 25 Jun 2019 17:56:24 -0400 Message-ID: <29176.1561499784@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk John Lumby writes: > Suggestion : it would be useful if REINDEX could ,=C2=A0=C2=A0 when some= new parameter is set , first determine current average leaf page density = in the index to be rebuilt, =C2=A0=C2=A0 (e.g. the value of=C2=A0pgstatind= ex().avg_leaf_density from the =C2=A0 pgstattuple extension ),=C2=A0 and t= hen adopt this density as the temporary override FILLFACTOR while rebuildi= ng index pages,=C2=A0 as to to minimize change in density. Um ... why bother reindexing at all, then? > This would avoid the saw-tooth effect on number of pages,=C2=A0=C2=A0 an= d also reduce the number of index page-splits which occur during the perio= d immediately following a REINDEX done with default FILLFACTOR of 90%.=C2=A0= =C2=A0 In effect,=C2=A0 it lessens the need for the physical reorganizatio= n aspect of REINDEX and focusses more on the function of removing dead=C2=A0= keys. I think you've confused REINDEX with VACUUM. It seems like a pretty poor substitute for that --- it's much more expensive and has worse locking requirements. regards, tom lane