Skip to main content
Version: Old ArrowSquid docs

Postgres add-on

To provision a postgres instance, add the addons.postgres: section to the deployment manifest. The add-on deploys a Postgres 14 instance and injects the DB_NAME, DB_USER, DB_PASS, DB_PORT environment variables to the api and processor squid services.

Config options

The add=on supports additional PG config options:

NameDescriptionTypeDefault valueOptional
config.statement_timeoutMax execution time after which any query is forcefully aborted, msnumber60000Optional
config. log_min_duration_statementLog queries executing longer than the given threshold, msnumber5000Optional
config. max_pred_locks_per_transactionSee Lock Managementnumber64Optional
config.max_locks_per_transactionSee Lock Managementnumber64Optional

Direct access

warning

Direct access is only avalilable for squids deployed with squid.yaml. For migrating from the old v0 flow, refer to the migration page.

Subsquid Cloud enables direct read access to the deployed PG instances. Launch the squid explorer with

sqd explorer

and navigate to DB access to inspect the PG connection string for the direct access.

Scaling

The postgres add-on supports storage and compute resource scaling by extending the scale.addons.postgres section of the deploy manifest. The following options are supported

NameDescriptionTypeDefault valueOptional
storageVolume size for the postgres containermemory resource units10GOptional
profileLog queries executing longer than the given threshold, mssmall | medium | largesmallOptional

The profile specifications for a postgres service are as follows:

Profilecolocated vCPU (max)colocated RAM (max)dedicated vCPU (requested)dedicated RAM (max)
small0.2768Mi12Gi
medium0.51.5Gi24Gi
large13Gi44Gi

Examples

manifestVersion: subsquid.io/v0.1
name: sample-squid
version: 1
description: |-
My advanced squid

build:

deploy:
addons:
postgres:
config:
statement_timeout: 100000
log_min_duration_statement: 100000
processor:
cmd: [ "node", "lib/processor" ]
api:
cmd: [ "npx", "squid-graphql-server"]

scale:
addons:
postgres:
storage: 100G
profile: medium