1

If I index a PostgreSQL table and then update it, do I need to re-index the table or is it automatically re-indexed?

Can someone provide a link to PostgreSQL documentation for further reading? I've got this so far: https://www.postgresql.org/docs/9.1/static/sql-createindex.html

Alan Kavanagh
  • 9,425
  • 7
  • 41
  • 65

2 Answers2

2

indexes in PostgreSQL do not need maintenance or tuning

You do not need to re-index manually.

For more details, please also read https://www.postgresql.org/docs/current/static/monitoring-stats.html

Bartosz Bilicki
  • 12,599
  • 13
  • 71
  • 113
2

From further reading in the PostgreSQL documentation:

Once an index is created, no further intervention is required: the system will update the index when the table is modified, and it will use the index in queries when it thinks doing so would be more efficient than a sequential table scan. But you might have to run the ANALYZE command regularly to update statistics to allow the query planner to make educated decisions. See Chapter 14 for information about how to find out whether an index is used and when and why the planner might choose not to use an index.

See: https://www.postgresql.org/docs/current/static/indexes-intro.html

Alan Kavanagh
  • 9,425
  • 7
  • 41
  • 65