A subgraph is the basic unit of data on The Graph, a protocol for indexing and querying blockchain data. Reading information directly from a blockchain, such as every trade on a decentralised exchange over a year, is slow and awkward. A subgraph solves this by defining, in advance, which smart contracts and events to watch, how to turn them into tidy records, and how applications may query those records using GraphQL, a query language for APIs.
Each subgraph is described by a subgraph manifest, together with a data schema and mapping code that transforms raw events into records. Once published, indexers on the network process the subgraph and answer queries for a fee paid in GRT tokens, while curators signal which subgraphs are worth indexing. Many DeFi dashboards, wallets and analytics sites rely on subgraphs rather than running their own nodes. Each query sent to a subgraph is usually written in GraphQL and returns only the fields that the application asks for.
Ref 1300000351