- Mastering PostgreSQL 12
- Hans Jürgen Sch?nig
- 158字
- 2021-08-20 10:00:19
Rebuilding indexes concurrently
Once in a while, it can be necessary (in rare circumstances) to recreate an index. For quite some time, PostgreSQL has provided CREATE INDEX CONCURRENTLY, which allows end users to create an index while a table is under a heavy write load. A normal CREATE INDEX statement blocks the table while the index is created and, therefore, it is hardly possible to create large indexes in a 24 x 7 OLTP database.
However, in some cases, it might be necessary to recreate all indexes in a database or a specific schema. PostgreSQL 12 allows you to run REINDEX CONCURRENTLY on an entire database, schema, or table:
test=# \h REINDEX
Command: REINDEX
Description: rebuild indexes
Syntax:
REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURRENTLY ] name
URL: https://www.postgresql.org/docs/12/sql-reindex.html
REINDEX CONCURRENTLY will dramatically reduce the pain caused by REINDEX and achieve results with minimal locking.
推薦閱讀
- 高效能辦公必修課:Word圖文處理
- Verilog HDL數(shù)字系統(tǒng)設(shè)計(jì)入門與應(yīng)用實(shí)例
- Spark編程基礎(chǔ)(Scala版)
- Getting Started with MariaDB
- 圖形圖像處理(Photoshop)
- Blockchain Quick Start Guide
- 機(jī)器人智能運(yùn)動(dòng)規(guī)劃技術(shù)
- 工業(yè)機(jī)器人維護(hù)與保養(yǎng)
- Mastering Geospatial Analysis with Python
- 數(shù)字多媒體技術(shù)基礎(chǔ)
- Cortex-M3嵌入式處理器原理與應(yīng)用
- Data Analysis with R(Second Edition)
- PowerPoint 2010幻燈片制作高手速成
- 大數(shù)據(jù)時(shí)代的調(diào)查師
- Java Deep Learning Projects