Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change snapshot lookups #239

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft

Change snapshot lookups #239

wants to merge 5 commits into from

Conversation

pjaspers
Copy link
Contributor

Seeing a lot fo these:

"ActiveRecord::StatementInvalid: PG::OutOfMemory: ERROR:  out of memory\nDETAIL:  Failed on request of size 39786433 in memory context \"printtup\".\n: SELECT  \"dhis2_snapshots\".* FROM \"dhis2_snapshots\" WHERE \"dhis2_snapshots\".\"project_anchor_id\" = $1 AND \"dhis2_snapshots\".\"id\" = $2 LIMIT $3"}

So as a theory, reworking the way we look up the nearest one. Keeping it more in postgres than in ruby. (Theory being that Rails is loading the snapshots with the '*' which is is causing postgres to load all the columns, including a large jsonb one, and by using a more selective approach we don't hit that)

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.

1 participant