Skip to main content
The SPQR Router configuration can be specified in JSON, TOML, or YAML format. The configuration file passing as a parameter to run command:
Refer to the pkg/config/router.go file for the most up-to-date configuration options.

General Settings

Network Settings

Availability Zone Settings

When prefer_same_availability_zone is false or availability_zone is empty, zone labels do not affect host selection. See Shards for host zone labels and a configuration example.

gRPC TLS Settings

client_tls configures outgoing internal gRPC connections, server_tls configures the internal gRPC API:
coordinator.yaml

Frontend Rules

Frontend rule is a specification of how clients connect to the router. Refer to the FrontendRule struct in the pkg/config/rules.go file for the most up-to-date configuration options.

Backend Rules

Backend Rule is a global setting that determines how the router connects to every shard. Refer to the BackendRule struct in the pkg/config/rules.go and pkg/config/auth_backend.go file for the most up-to-date configuration options.

Shards

Map of string to Shard objects. Refer to the Shard struct in the pkg/config/router.go file for the most up-to-date configuration options. Hosts can be assigned a connection priority with the PRIORITY <n> suffix. A priority of -1 disables the host entirely (it is treated as dead); any other value is reserved for future use. Example with availability zone preference enabled:
SPQR prefers db1.example.com and can fall back to db2.example.com if no suitable host is available in us-east-1a. The selected host must satisfy target-session-attrs.

Statistics Settings

Collects query execution time statistics at specified percentile levels. The router tracks two independent timing metrics:
  • Router Time (time spent in SPQR router)
  • Shard Time (time waiting for backend database)
When empty, statistics collection is disabled.

Feature Flags

Query Routing Settings

Query routing settings are nested under the query_routing configuration key and control how queries are routed across shards.
Many of these settings can be overridden at runtime using routing hints.
Refer to the QRouter struct in the pkg/config/router.go file for the most up-to-date configuration options.

Transaction Settings

Mode Settings

Debug Settings

DBpool Settings

QDB Settings