graphprotocol / graph-node

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL
https://thegraph.com
Apache License 2.0
2.91k stars 978 forks source link

Automated index creation #4666

Open lutter opened 1 year ago

lutter commented 1 year ago

Description

We could employ some simple heuristics to ease the need for manual index creation to support slow queries. The basic idea is that the LoadManager is aware of the load in each shard, and which queries (by shape hash) cause what percentage of the load there.

We could therefore use this information to trigger automatically creating indexes to speed up the query/queries that are causing most of the load. Once a decision has been made to improve a particular GraphQL query, we would run that query in trace mode to identify the slowest SQL query (corresponding to a specific part of the GraphQL query) and then use some heuristics to try and improve the query. For example, those heuristics could use

There's lots of experimentation we could do with these heuristics, but they could lower the load for operators considerably.

This issue is in complementary to #4325 as it covers very similar functionality, but could reduce the need for creating indexing rules, too.

Are you aware of any blockers that must be resolved before implementing this feature? If so, which? Link to any relevant GitHub issues.

Issue #4262 needs to addressed first to ensure that the LoadManager has accurate statistics about query execution

Some information to help us out

github-actions[bot] commented 11 months ago

Looks like this issue has been open for 6 months with no activity. Is it still relevant? If not, please remember to close it.

alex-pakalniskis commented 11 months ago

Related request shared with me during this week's IOH

automate creating indexes and deleting shitty ones -Payne