Contents Aster SQL and Function Reference


Add to my manuals
228 Pages

advertisement

Contents Aster SQL and Function Reference | Manualzz

REINDEX Aster Data proprietary and confidential

REINDEX

REINDEX -- rebuild indexes

Synopsis

REINDEX { INDEX | TABLE } name [ FORCE ];

Description

REINDEX rebuilds an index using the data stored in the index's table, replacing the old copy of the index. There are two main reasons to use REINDEX :

An index has become corrupt and contains invalid data. Although in theory this should never happen, in practice indexes may become corrupted due to software bugs or hardware failures.

The index in question contains a lot of dead index pages. This can occur with B-tree indexes in Aster Database under certain access patterns.

REINDEX

reclaims space by rewriting a new version of the index without the dead pages.

Parameters

INDEX

TABLE name

FORCE

Recreate the specified index.

Recreate all indexes of the specified table.

The name of the specific index, table, or database to be reindexed. Presently,

REINDEX DATABASE can only reindex the current database, so their parameter must match the current database's name.

This option is ignored if specified.

Notes

If you suspect corruption of an index on a user table, you can simply rebuild that index, or all indexes on the table, using

REINDEX INDEX

or

REINDEX TABLE

.

For all user-specified indexes,

REINDEX

is crash-safe and transaction-safe.

REINDEX

is similar to a drop and recreate of the index in that the index contents are rebuilt from scratch. However, the locking considerations are rather different.

REINDEX

locks out writes but not reads of the index's parent table. It also takes an exclusive lock on the specific index being processed, which will block reads that attempt to use that index. In contrast,

DROP INDEX momentarily takes exclusive lock on the parent table, blocking both writes and reads. The subsequent

CREATE INDEX

locks out writes but not reads; since the index is not there, no read will attempt to use it, meaning that there will be no blocking but reads may be forced into expensive sequential scans. Another important point is that the drop/create approach invalidates any cached query plans that use the index, while

REINDEX

does not.

Reindexing a single index or table requires being the owner of that index or table. Superusers can reindex anything.

Note!

Aster Database does not support reindexing the whole database. To reindex your database, run REINDEX on each table in the database.

V--70 Database SQL and Function Reference, version 4.6.2

aster data

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

advertisement

Table of contents