-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Defining an indexer data schema (#771)
### Description ![Screenshot 2025-01-15 at 5.06.34 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/vIwavW9noSx0eb70aDLz/e37ad4a5-027a-4a66-886c-5910b4bd522d.png) ### Checklist <!-- Read the Nextra Contributor's Guide here: https://aptos.dev/en/developer-platforms/contribute --> - If any existing pages were renamed or removed: - [x] Were redirects added to [next.config.mjs](../apps/nextra/next.config.mjs)? - [x] Did you update any relative links that pointed to the renamed / removed pages? - Do all Lints pass? - [x] Have you ran `pnpm fmt`? - [x] Have you ran `pnpm lint`?
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/define-schema.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: "Defining a Data Schema" | ||
--- | ||
|
||
# Defining a Data Schema | ||
|
||
The first step with indexing is choosing a database and defining a schema for the data that you want to store. | ||
|
||
## Schema Considerations | ||
When designing an indexer data schema, consider the following: | ||
- Customizability: A schema serves as an interface for your dApp to access data tailored to your specific contract or application. | ||
Ensure your schema is customized to meet your dApp's unique requirements. | ||
- Query Optimization: A well-designed schema can enable more efficient data retrieval, supporting advanced operations such as aggregations, complex filtering, and table joins. | ||
- Enhanced Performance: Schema design can significantly improve your dApp's performance. | ||
By using the indexer, a single indexer query can often replace multiple queries to the fullnode. | ||
|
||
## Aptos Core Processors | ||
All data exposed by the [Indexer API](../../aptos-hosted.mdx) is initially indexed using custom processors. | ||
Each core processor indexes a specific type of data. | ||
You can explore the [full list of processors](https://github.com/aptos-labs/aptos-indexer-processors/tree/main/rust/sdk-processor/src/processors) and the [complete indexer data schema](https://github.com/aptos-labs/aptos-indexer-processors/blob/main/rust/processor/src/db/postgres/schema.rs). | ||
|
||
The Aptos core processors and the [Quickstart Guide](../quickstart.mdx) use [PostgreSQL](https://www.postgresql.org/) as the database and [Diesel](https://diesel.rs/) as the ORM. | ||
However, you are free to choose any database or ORM that fits your needs. | ||
Popular alternatives include [SeaORM](https://www.sea-ql.org/SeaORM/) and [SQLx](https://github.com/launchbadge/sqlx). | ||
Setting up a database and using an ORM is beyond the scope of these tutorials. | ||
If you need guidance, refer to the tutorials linked above for more information. |