Thanks to Justin for the clarification around pgstatindex:

Staging:

version2
tree_level1
index_size425984
root_block_no3
internal_pages1
leaf_pages50
empty_pages0
deleted_pages0
avg_leaf_density70.86
leaf_fragmentation16

Production:

version2
tree_level1
index_size360448
root_block_no3
internal_pages1
leaf_pages41
empty_pages0
deleted_pages1
avg_leaf_density60.44
leaf_fragmentation39.02

On 11/4/19, 3:07 PM, "Peter Geoghegan" <p...@bowt.ie> wrote:

    On Mon, Nov 4, 2019 at 11:56 AM Justin Pryzby <pry...@telsasoft.com> wrote:
    > I think it's because some heap pages are being visited many times, due to 
the
    > index tuples being badly "fragmented".  Note, I'm not talking about
    > fragmentation of index *pages*, which is what pgstattuple reports (which
    > wouldn't have nearly so detrimental effect).  I could probably say that 
the
    > index tuples are badly "correlated" with the heap.

    But this is a unique index, and Scott indicates that the problem seems
    to go away for a while following a REINDEX.

    > In PG v12 you can use REINDEX CONCURRENTLY (but beware there's a crash
    > affecting its progress reporting, fix to be included in v12.1).

    PG v12 will store B-Tree duplicates in heap TID order, so if that's
    the problem then upgrading to v12 (and REINDEXing if the upgrade was
    performed using pg_upgrade) will fix it for good.

    --
    Peter Geoghegan



This email message contains information that Motus, LLC considers confidential 
and/or proprietary, or may later designate as confidential and proprietary. It 
is intended only for use of the individual or entity named above and should not 
be forwarded to any other persons or entities without the express consent of 
Motus, LLC, nor should it be used for any purpose other than in the course of 
any potential or actual business relationship with Motus, LLC. If the reader of 
this message is not the intended recipient, or the employee or agent 
responsible to deliver it to the intended recipient, you are hereby notified 
that any dissemination, distribution, or copying of this communication is 
strictly prohibited. If you have received this communication in error, please 
notify sender immediately and destroy the original message.

Internal Revenue Service regulations require that certain types of written 
advice include a disclaimer. To the extent the preceding message contains 
advice relating to a Federal tax issue, unless expressly stated otherwise the 
advice is not intended or written to be used, and it cannot be used by the 
recipient or any other taxpayer, for the purpose of avoiding Federal tax 
penalties, and was not written to support the promotion or marketing of any 
transaction or matter discussed herein.

Reply via email to