Set per-table autovacuum and analyze thresholds on large tables
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia esaminando le convenzioni delle migration e la procedura di deploy in Makefile:32-40, quindi individua l’entry point del management command utilizzato per le operazioni sul database. Implementa le impostazioni reversibili della tabella, il comportamento di errore in caso di lock timeout e la validazione dell’argomento della tabella descritti qui. Il lavoro è completato quando la migration, il comando ANALYZE, l’invocazione di deploy e i test elencati soddisfano i criteri di accettazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
- Default
autovacuum_vacuum_scale_factor = 0.2defers vacuum until 20% of a table's rows are dead — 3.36M tuples oncontentnode, 11.9M onassessmentitem. - Neither table has ever been vacuumed or analyzed, leaving the planner without statistics for the largest table in the database.
Complexity: Low
Target branch: hotfixes
Context
ALTER TABLE ... SET (autovacuum_*)is metadata-only and does not rewrite the table, but takes a briefACCESS EXCLUSIVElock. Oncontentnodethat can queue behind a long-running transaction and block everything behind it — gunicorn's timeout is 4000s, so long transactions are possible.pg_class.reloptionsis currently null for all three tables, and Django exposes no model-level API for storage parameters.- The app image has no
psql, soANALYZEmust be issued through a database cursor.
The Change
- A migration should set per-table autovacuum and analyze thresholds on
contentnode,assessmentitem, andfile:autovacuum_vacuum_scale_factor = 0.01andautovacuum_analyze_scale_factor = 0.005. fileshould additionally getautovacuum_vacuum_insert_scale_factor = 0.05— at 113M insert-heavy rows the dead-tuple threshold alone never fires, but the visibility map still needs maintaining.- The migration should set a
lock_timeoutand fail rather than retry, so a blockedACCESS EXCLUSIVEacquisition does not queue readers behind repeated attempts. - A general-purpose management command should run
ANALYZEagainst tables named at invocation, issued through a database cursor. make deploy-migrateshould invoke that command for the three tables, per the procedure at Makefile:32-40.
Acceptance Criteria
General
-
pg_class.reloptionsoncontentcuration_contentnode,contentcuration_assessmentitem, andcontentcuration_filecontainsautovacuum_vacuum_scale_factor=0.01andautovacuum_analyze_scale_factor=0.005 -
contentcuration_fileadditionally hasautovacuum_vacuum_insert_scale_factor=0.05 - The migration reverses cleanly, resetting all three tables to no storage parameters
- The migration aborts with a non-zero exit when it cannot acquire its lock within
lock_timeout - A management command runs
ANALYZEagainst tables passed as arguments -
make deploy-migrateinvokes that command for the three tables
Testing
-
last_analyzeis non-null on all three tables after the deploy step runs -
last_autovacuumbecomes non-null oncontentnodewithin 24 hours of the thresholds applying - Unit test covers the command's table-argument handling and its error on an unknown table
AI usage
Drafted with Claude Code, which measured the vacuum state, analyze state, and row counts cited here through read-only queries against the production database. I confirmed the deploy-migrate procedure and migration precedent against the Studio source, and set the threshold values and the fail-loudly behaviour.
- Lingua principale
- Python
- Stelle
- 191
- Fork
- 308
- Merge medio
- 2g 6h
- PR unite (30g)
- 65
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di learningequality/studio
-
Set unpublishable: true on PublishedChange by construction to simplify handleMaxRevs predicateApertaDEV: frontend P3 - low
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
learningequality/studio#5868 ·
I maintainer di solito rispondono entro 1 giorno
-
TAG: tech update / debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
learningequality/studio#2245 ·
I maintainer di solito rispondono entro 1 giorno
-
[QTI] Text entry answers are merged and reordered when the first answer has surrounding spaceApertabug DEV: frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 15/100
learningequality/studio#6309 ·
I maintainer di solito rispondono entro 1 giorno
-
bug DEV: frontend
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
learningequality/studio#6308 ·
I maintainer di solito rispondono entro 1 giorno
-
bug DEV: frontend
Difficoltà 3/5 1-2 giorni Idoneità per principianti 20/100
learningequality/studio#6307 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di learningequality/studio
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
EvaluationSuite.run fails with default args_for_task and mutates supplied kwargsForse già presa @ktz03 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
huggingface/evaluate#825 ·
I maintainer di solito rispondono entro 1 giorno
-
dependencies feature github_actions good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
wemake-services/wemake-django-template#3149 ·
I maintainer di solito rispondono entro 1 giorno
-
[request] vsg/1.1.16Apertaupstream update
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
conan-io/conan-center-index#31142 ·
I maintainer di solito rispondono entro 1 giorno
-
area:core bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno