fly-apps / fly-apps/safe-ecto-migrations
Verify concurrent index table locks
- Dominant language
- No language data
- Stars
- 387
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
It looks like the lock obtained in Postgres when creating an index concurrently `SHARE UPDATE EXCLUSIVE` should allow writes `ROW EXCLUSIVE`, but the guide currently implies that writes are blocked.
> With Postgres, instead create the index concurrently which does not block reads. There are two options:
[Postgres docs](https://www.postgresql.org/docs/15/explicit-locking.html):
> SHARE UPDATE EXCLUSIVE (ShareUpdateExclusiveLock)
> Conflicts with the SHARE UPDATE EXCLUSIVE, SHARE, SHARE ROW EXCLUSIVE, EXCLUSIVE, and ACCESS EXCLUSIVE lock modes.
> Acquired by VACUUM (without FULL), ANALYZE, CREATE INDEX CONCURRENTLY, CREATE STATISTICS, COMMENT ON, REINDEX CONCURRENTLY, and certain [ALTER INDEX](https://www.postgresql.org/docs/15/sql-alterindex.html) and [ALTER TABLE](https://www.postgresql.org/docs/15/sql-altertable.html) variants (for full details see the documentation of these commands).
> ROW EXCLUSIVE (RowExclusiveLock)
> Conflicts with the SHARE, SHARE ROW EXCLUSIVE, EXCLUSIVE, and ACCESS EXCLUSIVE lock modes.
> The commands UPDATE, DELETE, INSERT, and MERGE acquire this lock mode on the target table (in addition to ACCESS SHARE locks on any other referenced tables). In general, this lock mode will be acquired by any command that modifies data in a table.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the guide section containing the quoted explanation of concurrent Postgres indexes and compare its lock description with the linked Postgres explicit-locking documentation. Update the guide so it accurately describes whether writes are blocked, then verify that the surrounding migration advice remains consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100