HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Is there a need to keep refreshing the indexes from time-to-time?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
fromtheneedkeepindexestimerefreshingthere

Problem

This question is common for all the database products I use, viz. SQL Server, MySQL, Oracle and PostgreSQL.

I have created a fresh database and the tables, at present, have no records. I have created indexes on all such columns of tables which are needed in queries often. I want to know how indexes are physically (clustered) and logically (non-clustered) updated when I keep on adding records in tables? Is the index updated automatically or do I need to update the indexes manually, from time-to-time?

Solution

Indexes are automatically updated regarding the what is stored in them (the column values of the rows that are indexed).

However some DBMS require regular maintenance (aka "rebuild") of them in order to optimize the storage of the index values.

Older versions of Microsoft SQL Server required an index rebuild on a regular basis to keep them effecient. But I don't know if that is still true with newer versions (2005,2008)

There is no need to recreate indexes in Oracle.

The (auto)vacuum process of PostgreSQL should take care of reclaiming space, but they sometimes (rarely though) require a rebuild as well.

Context

StackExchange Database Administrators Q#5686, answer score: 10

Revisions (0)

No revisions yet.