Posts

Showing posts from January, 2022

PostgreSQL's Index Maintenance (B-tree reindex and drop unused indexes)

Image
 This article is not entirely complete yet, but it's still useful: Reindex Maintenance Operation:   Important Points: 1.       All the numbers and intervals in this document are experimental. 2.      All the scripts in this document must be changed mode to executable by using the following command: chmod +x scriptname.sh 3.      These scripts are intended to run as root or a user which can switch user to ‘postgres’ user passwordlessly. 4.      The scripts must run by /bin/sh like the following: /bin/sh scriptname.sh         In some of the bash scripts, you may wonder why there is no while loop. The truth is that there are embedded loops and nested loops, implemented via “bash -c”, “xargs”, or external bash script. •           PostgreSQL provides the index methods B-tree, hash, GiST, spgist, brin and GIN. Default is bt...