Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0hUZ-0004DT-Sf for pgsql-general@arkaria.postgresql.org; Tue, 06 Jul 2021 09:35:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m0hUY-00074w-Ro for pgsql-general@arkaria.postgresql.org; Tue, 06 Jul 2021 09:35:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0hUY-00074o-Ih for pgsql-general@lists.postgresql.org; Tue, 06 Jul 2021 09:35:46 +0000 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1m0hUW-0004qT-Pk for pgsql-general@lists.postgresql.org; Tue, 06 Jul 2021 09:35:46 +0000 Received: by mail-ot1-x333.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso20962499otu.10 for ; Tue, 06 Jul 2021 02:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=PcF0SXHa2e1lLo9NCbWYL8lB0D4aJXUOJ7DG+K5Nb2g=; b=fLZCM2ksKPmW2+bPO9OtqMopcT5sqk1L8q299EYTzUDL5T+DHVCffuax5EQ9uBKqWR F/C5xZOjpSveDNddfKbxY/Cwnj4522N9tqRIGzp4OMynjzJa8f707Kqn8aWAC07WBJK7 RavX+NYeuKUhYml6ASi1dc3rFe5aTTceAIuo01olON98THotOdQhagLSVw2+lapVmACR kxHTny5XzBSMpzHXq0aEoBycZ438Q0QVsckUKAIAckOpF+QiO4EkHMRCRecedVLr/DWm SyHV7mf/cEC1dttNpHHTku4381RFvQhTzkWib1FTyz2cnrOMf3JUGuwh/ta9BnYv9YPL q/vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=PcF0SXHa2e1lLo9NCbWYL8lB0D4aJXUOJ7DG+K5Nb2g=; b=rqC2aP6PdCVn0SeLkVVw93t2CS3ZmKI3fiUpmFdkkQJcImhK74sig4wAk+oWaM3pHT ZlPekrdFzdl9/tUVjcgMOTRRjs46I3HOe84OAX8vXTyuAI+7NFk8jsEeGqrs68DTZp6M mYomHPc1zjOANj2s2YN45aub1uKh2FrschKqxjUU5dhzElLP4wgp4IijoEYrwcXaOt/R KuMq/NHm+OFO+5ts/VgXGFuuJpbxVji2x8Sy645uwxwkaQVvLnmjhgiYFeMgYplDms+Z utUEs0sPTHxO3Opyyvcb/6XPAwpn6Z4LTxelrSjn0Dou+IYlErBp7SIYF5A+GmUFmhTw Notw== X-Gm-Message-State: AOAM5318X0/LCsMzhrkRpXI60FLivJ246nFkTO/vXxeZqqJUW3kKYQQ4 n3a4jnXS2T7wxS0kE+93RGj2P8D52l8XKg== X-Google-Smtp-Source: ABdhPJz0+8m13xmHxqeXCwfVSm4ZHk6YxeQmhRq79xbYvDHoagPOWm7yXUXXpGffBjGPv6sYOh3QNw== X-Received: by 2002:a9d:3c4:: with SMTP id f62mr11090927otf.57.1625564143055; Tue, 06 Jul 2021 02:35:43 -0700 (PDT) Received: from [192.168.88.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id v8sm3189000oth.69.2021.07.06.02.35.42 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 02:35:42 -0700 (PDT) To: pgsql-general@lists.postgresql.org From: Ron Subject: When to REINDEX a serial key? Message-ID: <7e6be66c-7bb7-58ff-a490-0837dd73424a@gmail.com> Date: Tue, 6 Jul 2021 04:35:41 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------9554568A2DA84358D5E0FA42" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------9554568A2DA84358D5E0FA42 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Server: RDS Postgresql 12.5 Client: Vanilla Postgresql 12.5 Like most systems, we have lots of tables indexed on sequences. Thus, all new keys are inserted into the "lower right hand corner" of the b-tree. The legacy RDBMS which I used to manage has a tool for analyzing (*not* in the Postgresql meaning of the word) an index, and displaying a histogram of how many layers deep various parts of an index are. Using that histogram, you can tell whether or not an index needs to be rebuilt. How does one get the same effect in Postgresql? -- Angular momentum makes the world go 'round. --------------9554568A2DA84358D5E0FA42 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Server: RDS Postgresql 12.5
Client: Vanilla Postgresql 12.5

Like most systems, we have lots of tables indexed on sequences.  Thus, all new keys are inserted into the "lower right hand corner" of the b-tree.

The legacy RDBMS which I used to manage has a tool for analyzing (not in the Postgresql meaning of the word) an index, and displaying a histogram of how many layers deep various parts of an index are.  Using that histogram, you can tell whether or not an index needs to be rebuilt.

How does one get the same effect in Postgresql?

--
Angular momentum makes the world go 'round.
--------------9554568A2DA84358D5E0FA42--