- Show data size per table/index in PostgreSQL
- REINDEX command
- Control sort with NULL
While using PostgreSQL DB, sometimes you may want to know which table/index is using capacity.
Source of the above SQL is here:
PostgreSQL seems to have unnecessary data remaining index unless you delete record well.
If there is such kind of data, it is better to run
REINDEX command, like this:
It would be nice to use
pg_repack which rebuilding a bloated table / index and rearranging records order to a specified index.
It can run online because it does not keep locking.
Control a position of NULL in sort order:
By the way, the default of PostgreSQL is