The Graph.

Bài viết

Chia sẻ kiến thức của bạn.

TheGraph Mod QST.
Mar 29, 2024
Hỏi đáp Chuyên Gia

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
Chia sẻ
Bình luận
.

Câu trả lời

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
Câu trả lời chính thức
Bình luận
.

Bạn có biết câu trả lời không?

Hãy đăng nhập và chia sẻ nó.

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.

259Bài viết259Câu trả lời
Sui.X.Peera.

Kiếm phần của bạn từ 1000 Sui

Tích lũy điểm danh tiếng và nhận phần thưởng khi giúp cộng đồng Sui phát triển.