graphprotocol / graphprotocol/graph-node

Rules-based system to control index creation and similar attributes

Aperta
#4,325 6 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Stale
Lingua principale
Rust
Stelle
3.2k
Fork
1.1k
Merge medio
4g 1h
PR unite (30g)
1

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Usa graphman e i percorsi esistenti per la manipolazione del database come punti di ingresso; innanzitutto determina come sono rappresentate e applicate le impostazioni correnti di indice, cronologia e attributi. Definisci come elencare, eliminare e ricaricare le regole senza riavviare graph-node, come applicarle durante il deployment e come applicarle ai deployment esistenti; il lavoro è completato quando questi flussi di lavoro sono specificati e coperti da test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
databases
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.