graphprotocol / graphprotocol/graph-node

Rules-based system to control index creation and similar attributes

Offen
#4,325 6 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Stale
Vorherrschende Sprache
Rust
Sterne
3.2k
Forks
1.1k
Ø Merge
4 T. 1 Std.
Gemergte PRs (30 T.)
1

Beschreibung

There are a few things that can be set manually through graphman or directly by manipulating the database that affect how subgraph data is stored, and can help query performance. Those items include:

  • custom indexes (multicolumn indexes or partial indexes)
  • creation of default attribute indexes (a lot of them are never used)
  • account-like optimization
  • statistics target
  • amount of history

An example of what that could like like in YAML form is

# Sketch of what an index definition file could look like. The file will
# contain many entries like this one
- rule: Messari analytics subgraphs
  match:
    # All subgraphs whose name matches this regex will be treated according
    # to these actions
    name: messari/.*
  actions:
    # Keep 10,000 blocks of history
    - history: 10000   
    - entity:
        name: LiquidityPoolSnapshot
        index:
          - on: [pool, timestamp]
    - entity:
        name: LiquidityPool
        # Turn off attribute indexes
        default_indexes: false
        # Set the table to account-like
        account-like: true
        # Increase the statistics target
        stats-target: 300
        # Create some custom indexes
        index:
          # Use a GiST index since we use block_range
          - on: [block_range, timestamp, id]
            method: gist
          # A partial index that only covers blocks after a certain point
          # TODO: since the block number means different things on
          # different networks, we should either use a timespan or let users
          # match on network
          - on: [timestamp, id]
            after: 15664000
          - on: [pool_address, block_range, timestamp]
            method: gist

We need to think more about the way in which operators interact with these rules. Some requirements:

  • changing rules should not require a restart of graph-node
  • it should be possible to list rules, delete them etc.
  • rules should be applied when a subgraph is deployed, but there should also be tooling to apply a new rule to an existing deployment.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Verwende graphman und die vorhandenen Pfade zur Datenbankmanipulation als Einstiegspunkte; ermittle zunächst, wie die aktuellen Index-, Verlaufs- und Attribut-Einstellungen dargestellt und angewendet werden. Lege fest, wie Regeln aufgelistet, gelöscht, ohne einen Neustart von graph-node neu geladen, bei der Bereitstellung angewendet und auf bestehende Bereitstellungen angewendet werden; als erledigt gilt die Aufgabe, wenn diese Abläufe spezifiziert und durch Tests abgedeckt sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
databases
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.