Skip to main content
A short checklist for making your squid fast, correct and cheap to run. Most of the items below link to a dedicated page with details.

Process data in batches

Make sure that you use batch processing throughout your code: transform data in memory over the whole batch and persist it with a small number of batched upsert/insert calls. Avoid loading or saving single entities unless strictly necessary. Consider using @belopash/typeorm-store for large projects with extensive entity relations and frequent database reads.

Select only the fields you need

Data requests are configured at the processor level. Use setFields to request only the fields your handler actually reads — see field selection. Requesting fewer fields means smaller responses from the data source and faster syncing. The same discipline applies to data requests themselves: subscribe only to the addresses, topics or calls you process.

Filter data in the batch handler

Even when your processor configuration requests data from particular contracts or addresses, check in the batch handler that each data item matches what your processing code expects. This ensures that future changes to the processor configuration will not silently route newly added data to your old processing code.

Index your database

If your squid saves its data to a database, make sure your schema has @index decorators for all entities that will be looked up frequently.

Harden your GraphQL API

If your squid serves a GraphQL API:
  1. Do not use OpenReader if your application uses subscriptions. Instead, use PostGraphile or Hasura.
  2. If you do use OpenReader, configure the built-in DoS protection against heavy queries and set up caching.
  3. If you use PostGraphile or Hasura, follow their docs to harden your service in a similar way.

Prepare for production deployment

If you deploy to SQD Cloud, go through the Cloud best practices checklist: a professional organization, dedicated resources, an adequate scale: section, zero-downtime updates, secrets for all sensitive data and proper logging.