carloscape/octorato/index-creation-concurrently

Claude Code and agent skill by carloscape/octorato

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Index Creation (CONCURRENTLY)

Install

npx vskill@latest install carloscape/octorato/index-creation-concurrently

SKILL.md

Index Creation (CONCURRENTLY)

What

CREATE INDEX CONCURRENTLY builds an index without holding an exclusive lock on the table. Regular CREATE INDEX blocks all writes (INSERT/UPDATE/DELETE) for the duration of the build. The CONCURRENTLY variant allows writes to continue while the index is being built.

Why

On production tables with active traffic, a regular index build can cause downtime. A 100M-row table might take minutes to index, during which all writes are blocked. CONCURRENTLY eliminates this risk at the cost of a slightly longer build time.

Lock comparison (PG 16 docs: explicit-locking.html)
ModeLock AcquiredBlocks Writes?Blocks Reads?
CREATE INDEXSHAREYes (INSERT/UPDATE/DELETE blocked)No
CREATE INDEX CONCURRENTLYSHARE UPDATE EXCLUSIVENoNo

How

Basic concurrent index
sql
CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_appointmentinfo_hospitalid
ON public."AppointmentInfo" ("HospitalId");
Covering index (INCLUDE)
sql
CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_vwr_animalid_covering
ON analytics."events" ("entity_id")
INCLUDE ("AnimalName", "Species", "Breed");
Important: Cannot run inside a transaction
sql
-- This FAILS:
BEGIN;
CREATE INDEX CONCURRENTLY ix_test ON public."MyTable" ("MyCol");
COMMIT;
-- This WORKS (outside any transaction block):
CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_test
ON public."MyTable" ("MyCol");

Index Types We Used

TypePurposeExample
B-tree (default)Equality and range queriesWHERE "HospitalId" = 123
Covering (INCLUDE)Avoid table lookups for common queriesIndex-only scans
CompositeMulti-column lookupsWHERE "Col1" = x AND "Col2" = y

When to Use

  • Any column used in WHERE, JOIN, or ORDER BY clauses
  • FK columns (PostgreSQL does NOT auto-create indexes on FK columns)
  • High-cardinality columns that filter large result sets

Where We Used It

  • ****: Index on AppointmentInfo.HospitalId (supporting FK)
  • ****: Index on AppointmentInfo.ProviderId (supporting FK)
  • ****: 6 high-value indexes on analytics tables (covering indexes)
  • ****: Baseline indexes on DINO_EC tables

References

-- see "Indexing strategy (actual usage)" and Backlog #5 (Advanced indexes)

-- and index decisions

Gotchas

  • CONCURRENTLY cannot run inside a DO block or explicit transaction
  • If a concurrent build fails, it leaves an INVALID index -- check with:

``sql SELECT indexrelid::regclass, indisvalid FROM pg_index WHERE NOT indisvalid; ``

  • IF NOT EXISTS prevents errors on re-run but does NOT rebuild invalid indexes
  • Concurrent builds take ~2x longer than regular builds (two table scans)
  • Building many indexes concurrently at once can impact performance

Category: DDL | Origin: ,

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
17
Repository forks
7
7-day trend score
14

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/carloscape/octorato/index-creation-concurrently/badge)](https://verified-skill.com/skills/carloscape/octorato/index-creation-concurrently)

Something wrong with this skill or its page? Tell us.