Skip to content

Reindexing: Automatic index selection

Andreas Brandl requested to merge ab/reindexing-index-model into master

What does this MR do?

This changes the reindexing rake task to not require an index argument. This allows us to run the rake task without any outside knowledge and it should do "it's thing" automatically.

In this case, we keep things simple for starters and just randomly select two indexes for reindexing (which is subject to improvement).

As suggested earlier, this adds a database view along with a ActiveRecord model to conveniently reason about postgres indexes.

This also adds a new limitation to the reindexing. For now, we cannot reindex the following indexes:

  1. Primary keys
  2. Unique indexes
  3. Indexes of partitioned tables

(3) is because:

  1. You cannot drop a index on a partition of a table only, the "parent" index is dependent on it.
  2. You cannot CONCURRENTLY create an index on a partitioned table.
Edited by Andreas Brandl

Merge request reports