DSQL is the PREFERRED relational database. This decision was made for fast serverless distributed SQL,
effortless scaling, multi-region viability, among other advantages.
ALWAYS use ASYNC indexes - CREATE INDEX ASYNC is mandatory
MUST Serialize arrays/JSON as TEXT - Store arrays/JSON as TEXT (comma separated, JSON.stringify)
ALWAYS Batch within row limit - maintain transaction limits (defaults: 3,000 rows, 10 MiB, 5 minutes — verify via the AWS MCP Server’s aws___search_documentation if available, or check the DSQL documentation (opens in a new tab) directly: aurora dsql transaction limits)
REQUIRED: Sanitize SQL inputs with allowlists, regex, and quote escaping - See Input Validation
MUST follow correct Application Layer Patterns - when multi-tenant isolation or application referential integrity are required; refer to Application Layer Patterns
REQUIRED use DELETE for truncation - DELETE is the only supported operation for truncation
SHOULD test any migrations - Verify DDL on dev clusters before production
Plan for Horizontal Scale - DSQL is designed to optimize for massive scales without latency drops; refer to Horizontal Scaling
SHOULD use connection pooling in production applications - Refer to Connection Pooling
SHOULD debug with the troubleshooting guide: - Always refer to the resources and guidelines in troubleshooting.md
ALWAYS use scoped roles for applications - Create database roles with dsql:DbConnect; refer to Access Control
MUST ALWAYS Execute via psql (use scripts/psql-connect.sh--command for single statements, --script for multi-statement files) or your driver’s read path
ALWAYS separate schema (DDL) and data (DML) changes
MUST use CREATE INDEX ASYNC: No synchronous creation (defaults: max 24 indexes per table, 8 columns per index — verify via the AWS MCP Server’s aws___search_documentation if available, or check the DSQL documentation (opens in a new tab): aurora dsql index limits)
Defaults below; verify against the live limits via the AWS MCP Server’s aws___search_documentation if available (aurora dsql transaction limits), or read the DSQL documentation (opens in a new tab) directly:
SHOULD modify at most 3,000 rows per transaction
SHOULD have maximum 10 MiB data size per write transaction
MANDATORY for Application Referential Integrity:
If foreign key constraints (application referential integrity) are required,
implement the following pattern instead:
MUST validate parent references before INSERT
MUST check for dependents before DELETE
MUST implement cascade logic in application code
MUST handle orphaned records in application layer
MANDATORY for Multi-Tenant Isolation:
tenantId is ALWAYS first parameter in repository methods
ALL queries include WHERE tenant_id = ?
ALWAYS validate tenant ownership before operations
CREATE INDEX ASYNC idx_name ON table(column); ← ALWAYS ASYNCALTER TABLE t ADD COLUMN c VARCHAR(50); ← ONE AT A TIMEALTER TABLE t ADD COLUMN c2 INTEGER; ← SEPARATE STATEMENTUPDATE table SET c = 'default' WHERE c IS NULL; ← AFTER ADD COLUMN
PRIMARY KEY, UNIQUE, NOT NULL, CHECK, DEFAULT (in CREATE TABLE)
Join on any keys; DSQL enforces PRIMARY KEY, UNIQUE, NOT NULL, and CHECK constraints
at the database level. Foreign-key referential integrity must be enforced in the
application layer (see Application-Layer Patterns above).
Defaults below; verify against the live limits via the AWS MCP Server’s aws___search_documentation if available (aurora dsql transaction limits), or read the DSQL documentation (opens in a new tab) directly: