Skip to content

Increase statement_timeout and lock_timeout in db migration#494

Merged
GianlucaFicarelli merged 1 commit intomainfrom
increase_statement_timeout
Jan 5, 2026
Merged

Increase statement_timeout and lock_timeout in db migration#494
GianlucaFicarelli merged 1 commit intomainfrom
increase_statement_timeout

Conversation

@GianlucaFicarelli
Copy link
Copy Markdown
Collaborator

Considering acceptable a statement timeout of 30 seconds, it should fix the failure in the current db migration:

sqlalchemy.exc.OperationalError: (psycopg2.errors.QueryCanceled) canceling statement due to statement timeout

during the query:

UPDATE measurement_kind
SET measurement_label_id = ml.id
FROM measurement_label ml
WHERE ml.entity_type = 'cell_morphology'::entitytype
AND ml.pref_label = measurement_kind.pref_label

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
pytest 97.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GianlucaFicarelli
Copy link
Copy Markdown
Collaborator Author

For the record, when running the migration locally with a similar db and ~400k records, without private data:

2026-01-05 12:31:29.685 UTC [7218] LOG:  statement:
	            UPDATE measurement_kind
	            SET measurement_label_id = ml.id
	            FROM measurement_label ml
	            WHERE ml.entity_type = 'cell_morphology'::entitytype
	            AND ml.pref_label = measurement_kind.pref_label
	       
2026-01-05 12:31:33.470 UTC [7218] LOG:  duration: 3785.887 ms

and for comparison, even doing an update without join takes more than 2 seconds:

entitycore=*# UPDATE measurement_kind set measurement_label_id=measurement_label_id;
UPDATE 397461
Time: 2291.946 ms (00:02.292)

@GianlucaFicarelli GianlucaFicarelli merged commit b8f4d8f into main Jan 5, 2026
2 checks passed
@GianlucaFicarelli GianlucaFicarelli deleted the increase_statement_timeout branch January 5, 2026 12:43
GianlucaFicarelli added a commit that referenced this pull request Jan 5, 2026
* origin/main:
  Add entity_type filter to measurement_label (#496)
  Add StructuralDomain.not_applicable (#495)
  Increase statement_timeout and lock_timeout in db migration (#494)
  Use scope=function in get_db dependency (#492)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants