graph-node icon indicating copy to clipboard operation
graph-node copied to clipboard

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

Open lutter opened this issue 1 year ago • 3 comments

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 avatar Apr 23 '24 01:04 lutter

@lutter is this ready for review?

mangas avatar May 28 '24 11:05 mangas

It is ready for review in the sense that it does what it claims to do, but it introduces a bunch of machinery whose full value we'd only reap if we used it more widely. But maybe it's enough to do this as a first step in that direction.

lutter avatar Jun 06 '24 00:06 lutter

This pull request hasn't had any activity for the last 90 days. If there's no more activity over the course of the next 14 days, it will automatically be closed.

github-actions[bot] avatar Sep 13 '24 00:09 github-actions[bot]

Rebased to latest master and addressed review comment

lutter avatar Oct 22 '24 21:10 lutter