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

Smarter Reactive Queries #49

Open
tantaman opened this issue Aug 18, 2022 · 0 comments
Open

Smarter Reactive Queries #49

tantaman opened this issue Aug 18, 2022 · 0 comments

Comments

@tantaman
Copy link
Collaborator

Currently we just re-run a query whenever one of its queried tables is updated.

This is good enough for now (based on current perf numbers and being in beta) but in the future if we need row-level reactivity some ideas are:

For single hop queries, we can run expressions in-memory against the modified/created/deleted node.

For multi-hop we of course lose the ids of the nodes we joined on. We have a few options:

  1. 👎 Require materialized views so all queries are single hop
    1. Horrible devx
    2. Horrible to maintain
    3. We could automate this if all queries are statically known ala Relay.
  2. 👎 In the background, fetch ids of hops.
  3. what if there are thousands or millions of these for a given hop?
  4. 👍 Model the query path as a graph.
    1. We know:
      1. Start node
      2. End node(s)
      3. Some updated node inside the path (the target of the mutation)
    2. We can use that to run simpler queries across subsections of the path to understand if the mutation target is part of the original query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant