Menu

How to classify CREATE INDEX CONCURRENTLY state with pg_index
📰

How to classify CREATE INDEX CONCURRENTLY state with pg_index

DEV Community: backend·Chris Rodriguez·about 4 hours ago
#zI52z8ox
#devtobackend#devto#dev#index#indisvalid
Long article (593 words) — no AI summary yet.
Reading 0:00
15s threshold

A concurrent PostgreSQL index build can fail without making the index name disappear. That makes an existence check misleading: a catalog row may remain even though PostgreSQL cannot use the index for query planning.

The implementation queries pg_index for one named index relation and joins pg_class to return readable index and table names. It interprets four catalog booleans instead of collapsing them into one “healthy” result.

The key decision is to separate write maintenance from query use. indisready answers whether inserts and updates should maintain the index. indisvalid answers whether PostgreSQL can use it for queries. A live index with indisready true and indisvalid false is therefore classified as an invalid leftover: it can still impose write overhead while remaining ineligible for plans.

The interpretation starts with indislive . A false value means the index is being dropped, so it should not be reported as an active failed build. For a live index, false indisvalid becomes invalid-leftover .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.