Ahh, I just tried to do the same with reindexdb cli tool and the actual syntax is REINDEX (VERBOSE) TABLE sales; Sorry for unnecessary question. Anyway maybe we can add this to documentation as a example. I can prepare patch for this if welcomed.so 16. 11. 2019 v 18:40 odesílatel Josef Šimánek <josef.simanek@xxxxxxxxx> napsal:Hello,according to https://www.postgresql.org/docs/11/sql-reindex.html VERBOSE option is valid for REINDEX command for 11.3 PostgreSQL server. Anyway I'm getting error using VERBOSE option.project_production=# REINDEX VERBOSE TABLE sales;
ERROR: syntax error at or near "VERBOSE"
LINE 1: REINDEX VERBOSE TABLE sales;
Time: 0.235 msI'm wondering if I'm doing anything wrong or actual documentation is wrong. Any ideas?
REINDEXREINDEX — rebuild indexes SynopsisREINDEX [ ( Description
Parameters
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
Things are more difficult if you need to recover from corruption of
an index on a system table. In this case it's important for the
system to not have used any of the suspect indexes itself.
(Indeed, in this sort of scenario you might find that server
processes are crashing immediately at start-up, due to reliance on
the corrupted indexes.) To recover safely, the server must be started
with the
One way to do this is to shut down the server and start a single-user
PostgreSQL server
with the
Alternatively, a regular server session can be started with
Reindexing a single index or table requires being the owner of that
index or table. Reindexing a schema or database requires being the
owner of that schema or database. Note that is therefore sometimes
possible for non-superusers to rebuild indexes of tables owned by
other users. However, as a special exception, when
Reindexing partitioned tables or partitioned indexes is not supported. Each individual partition can be reindexed separately instead. Rebuilding Indexes ConcurrentlyRebuilding an index can interfere with regular operation of a database. Normally PostgreSQL locks the table whose index is rebuilt against writes and performs the entire index build with a single scan of the table. Other transactions can still read the table, but if they try to insert, update, or delete rows in the table they will block until the index rebuild is finished. This could have a severe effect if the system is a live production database. Very large tables can take many hours to be indexed, and even for smaller tables, an index rebuild can lock out writers for periods that are unacceptably long for a production system.
PostgreSQL supports rebuilding indexes with minimum locking
of writes. This method is invoked by specifying the
The following steps occur in a concurrent reindex. Each step is run in a separate transaction. If there are multiple indexes to be rebuilt, then each step loops through all the indexes before moving to the next step.
If a problem arises while rebuilding the indexes, such as a
uniqueness violation in a unique index, the postgres=# \d tab Table "public.tab" Column | Type | Modifiers --------+---------+----------- col | integer | Indexes: "idx" btree (col) "idx_ccnew" btree (col) INVALID
The recommended recovery method in such cases is to drop the invalid index
and try again to perform
Regular index builds permit other regular index builds on the same table
to occur simultaneously, but only one concurrent index build can occur on a
table at a time. In both cases, no other types of schema modification on
the table are allowed meanwhile. Another difference is that a regular
Furthermore, indexes for exclusion constraints cannot be reindexed
concurrently. If such an index is named directly in this command, an
error is raised. If a table or database with exclusion constraint indexes
is reindexed concurrently, those indexes will be skipped. (It is possible
to reindex such indexes without the ExamplesRebuild a single index: REINDEX INDEX my_index;
Rebuild all the indexes on the table REINDEX (VERBOSE) TABLE my_table;
Rebuild all indexes in a particular database, without trusting the system indexes to be valid already: $ Rebuild indexes for a table, without blocking read and write operations on involved relations while reindexing is in progress: REINDEX TABLE CONCURRENTLY my_broken_table; Compatibility
There is no See AlsoCREATE INDEX, DROP INDEX, reindexdbCTRL+V to toggle the panel
|
Attachment:
screenshot--2019.12.13-02_03_50.png
Description: PNG image