Waiting for 9.5 – REINDEX SCHEMA

On 8th of December, Simon Riggs committed patch:

REINDEX SCHEMA
 
Add new SCHEMA option to REINDEX and reindexdb.
 
Sawada Masahiko
 
Reviewed by Michael Paquier and Fabrízio de Royes Mello

This is very simple thing, so the description will not be long. But – I'm mostly a DBA, so all things that give me more power are welcome 🙂

REINDEX is a command that can be used to remove bloat from index(es). Normally one would do:

$ reindex INDEX some_index_name;

But you can also, do:

$ reindex TABLE some_table;

to reindex all indexes on given table, or

$ reindex DATABASE some_db;

to handle all indexes in given database.

Or you can even:

$ reindex system some_db;

to reindex system indexes in given database (well, it has to be current db).

Now, we got new form:

$ reindex schema some_schema;

Which will reindex all indexes on all tables in given schema. Including indexes on toast tables for tables in this schema.

I like it. Would love it if we'd finally get “reindex concurrently", but anyway it's a nice addition.