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

graph, store: Avoid using to_jsonb when looking up a single entity #5372

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lutter
Copy link
Collaborator

@lutter lutter commented Apr 23, 2024

Our queries all ultimately get their data by doing something like select to_jsonb(c.*) from ( ... complicated query ... ) c because when these queries were written it was far from obvious how to generate queries with Diesel that select columns whose number and types aren't known at compile time.

The call to to_jsonb forces Postgres to encode all data as JSON, which graph-node then has to deserialize which is pretty wasteful both in terms of memory and CPU.

This commit is focused on the groundwork for getting rid of these JSON conversions and querying data in a more compact and native form with fewer conversions. It only uses it in the fairly simple case of Layout.find, but future changes will expand that use

@lutter lutter marked this pull request as draft April 25, 2024 19:55
lutter added 7 commits May 1, 2024 16:26
Our queries all ultimately get their data by doing something like `select
to_jsonb(c.*) from ( ... complicated query ... ) c` because when these
queries were written it was far from obvious how to generate queries with
Diesel that select columns whose number and types aren't known at compile
time.

The call to `to_jsonb` forces Postgres to encode all data as JSON, which
graph-node then has to deserialize which is pretty wasteful both in terms
of memory and CPU.

This commit is focused on the groundwork for getting rid of these JSON
conversions and querying data in a more compact and native form with fewer
conversions. It only uses it in the fairly simple case of `Layout.find`,
but future changes will expand that use
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.

None yet

1 participant