The Graph.

Пост

Поделитесь своими знаниями.

TheGraph Mod QST.
Mar 29, 2024
Экспертные Вопросы и Ответы

Relational database when using subgraph for event indexing

I'm exploring the use of subgraph to index events in my project. I'm wondering if setting up a relational database is still necessary in this scenario. Would the subgraph alone be sufficient for efficient event indexing, or should I consider incorporating a relational database as well? I'd appreciate any insights or recommendations from the community.

  • The Graph
  • GraphQL
  • Indexers
  • Subgraph
0
1
Поделиться
Комментарии
.

Ответы

1
TheGraph Mod ANS.
Mar 29 2024, 23:35

The subgraph serves as a relational database in this context. Here are a couple of approaches you can take when storing events as entities or building more descriptive entities to transform the data:

  1. Storing events as entities:

    • Each event can be stored as a separate entity, allowing you to easily query and retrieve specific events.
    • This approach provides a straightforward representation of the data, but it may result in a large number of entities depending on the volume of events.
  2. Building descriptive entities:

    • Instead of storing events as individual entities, you can create more descriptive entities that aggregate and transform the data.
    • For example, you can create a "protocol" entity that includes counters for activeAccounts or totalValueLocked. This entity can be updated based on the events received, providing a more concise representation of the data.
    • By building descriptive entities, you can simplify the querying process and potentially reduce the number of entities in your subgraph.

Both approaches have their own advantages and considerations, so it's important to choose the one that best suits your specific use case. Additionally, you may need to consider the scalability and performance implications of each approach, especially when dealing with a large volume of events.

0
Официальный ответ
Комментарии
.

Знаете ответ?

Пожалуйста, войдите в систему и поделитесь им.

The Graph is a decentralized protocol for indexing and querying blockchain data. The Graph makes it possible to query data that is difficult to query directly.

259Посты259Ответы
Sui.X.Peera.

Заработай свою долю из 1000 Sui

Зарабатывай очки репутации и получай награды за помощь в развитии сообщества Sui.