Skip to content

Change snapshot lookups#239

Draft
pjaspers wants to merge 5 commits into
devfrom
pj/change-snapshot-lookups
Draft

Change snapshot lookups#239
pjaspers wants to merge 5 commits into
devfrom
pj/change-snapshot-lookups

Conversation

@pjaspers
Copy link
Copy Markdown
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