Subsquid vs TheGraph
TheGraph is an indexing protocol and framework for EVM chains. In TheGraph, indexing projects are called subgraphs. A subgraph typically listens to events emitted by a smart contract and presents the indexed data with a user-defined GraphQL API. A subgraph can be compared to a squid, but with significantly less flexibility due to the design of indexing nodes used in TheGraph.
|Programming language||Typescript||AssemblyScript (complied to WASM)|
|Indexing speed||~1k-50k bps||~100-150 bps|
|Real-time indexing (unfinalized blocks)||Yes (*)||No|
|Customizable DB migrations||Yes||No|
|Factory contract indexing||Yes, via wildcards||Yes|
|Analytic data targets||BigQuery, Parquet, CSV||No|
|Local setup||Easy||Requires an archival node|
|GraphQL API||Generated from ||Generated from |
|Custom resolvers and mutations||Yes||No|
|Hosted service||Yes||Yes (to be sunset)|
|Secret env variables||Yes||No|
|Payment||Fiat, subscription-based (**)||GRT, pay-per-query|
|Decentralization||Opt-in, via decentralized data targets (Kwil DB, Ceramic)||TheGraph network|
(*) to be supported by the Squid SDK in Q1 2023
(**) for the Aquarium Premium plan
By design, TheGraph indexing node is a black-box that executes subgraphs compiled into WASM. The data is sourced directly from the archival node and local IPFS, and the processed data is stored in a built-in Postgres database. The data stored in the database is considered to be "sealed", so that no external process can modify or read the data except through the GraphQL interface.
On the contrary, Subsquid employs a radically open modular architecure with separated data extraction and filtering (Archives) and data transformation and presentation (Squid SDK). The Squid SDK offers pluggable data targets for both online and offline use-cases.