Cloudflare D1

Serverless SQLite database for Workers with Time Travel point-in-time recovery.

Provider
cloudflare
Category
Data
Properties · 7 set by this component
propertytypevaluesrequiredkind defaultthis component
appendOnly · advancedboolean—nofalseinherited
backupEnabledboolean—nofalse▸ true
backupRetentionDaysinteger—no—▸ 30
commitProtocol · advancedenumsingle | two-phasenosingleinherited
concurrencyControl · advancedenumpessimistic | optimistic | constraintno—inherited
distributedboolean—nofalse▸ false
encryptionAtRestboolean—nofalseinherited
idEncodesShard · advancedboolean—nofalseinherited
instancesinteger—no—inherited
locationHint · component propertyenumenam | wnam | weur | eeur | apac | ocno—inherited
managedboolean—nofalse▸ true
maxColumnsPerTable · component propertyinteger—no100inherited
maxDatabaseSizeGb · component propertyinteger—no10inherited
maxDatabasesPerAccount · component propertyinteger—no50000inherited
multiWriterboolean—nofalse▸ false
readReplication · component propertyboolean—nofalseinherited
replicaFanout · advancedinteger—no—inherited
replicaOfref—no—inherited
replicationenumnone | async | syncnonone▸ none
shardKeystring—no—inherited
shardedboolean—nofalse▸ false
Rules that apply · 6

Every rule whose selector covers this component's kind or its category. Whether a rule fires depends on the design: its properties, its edges and its groups.

business-updates-without-index-propagation

Application servers write this database and the design keeps a search index, but nothing captures the database's changes. The index then depends on the application writing to both places, and the two drift apart silently.

  • — all of these hold:
  • — the node has at least one synchronous incoming edge from an app-server
  • — the design contains a node of kind search-index
  • — this does not hold:
  • — the node has at least one outgoing edge to a change-data-capture
datastore-missing-backup

A system of record with backups off, or with no retention period stated, cannot be restored. The loss is discovered on the day it matters.

  • — any of these hold:
  • — the node's `backupEnabled` is false
  • — the node's `backupRetentionDays` has no value
datastore-single-region

The design promises multi-region availability, but this datastore sits in one region and does not replicate. A region outage takes the system of record with it.

  • — all of these hold:
  • — the design requirement `availability.multiRegion` is true
  • — the node sits inside exactly 1 region group
  • — the node's `replication` is "none"
read-heavy-path-without-cache

The design states a read-heavy workload and application servers read this datastore directly, yet the design has no cache anywhere. Every read pays a database round trip.

  • — all of these hold:
  • — the design requirement `traffic.readWriteRatio` is a number greater than 10
  • — the node has at least one synchronous incoming edge from an app-server
  • — this does not hold:
  • — the design contains a node of kind cache
read-replica-as-sole-scaling

Asynchronous read replicas scale reads only. When the store is neither sharded nor distributed the writes still land on one primary, so the replicas add nothing at the declared peak.

  • — all of these hold:
  • — the node's `replication` is "async"
  • — the node's `sharded` is false
  • — the node's `distributed` is false
  • — the node's declared requests per second is more than 5000
single-writer-primary-at-peak-qps

A single-writer, unsharded relational primary has a throughput ceiling. Declaring more than five thousand requests per second against it means the peak finds that ceiling in production.

  • — all of these hold:
  • — the node's `multiWriter` is false
  • — the node's `sharded` is false
  • — the node's declared requests per second is more than 5000
Use it in a design
nodes:
  - { id: "d1", component: "cloudflare-d1" }
Other SQL database products · 75
ApsaraDB for OceanBasealibaba-oceanbasealibabacloudsql-databasePolarDBalibaba-polardbalibabacloudsql-databasePolarDB-Xalibaba-polardb-xalibabacloudsql-databaseApsaraDB RDSalibaba-rdsalibabacloudsql-databaseAmazon Auroraauroraawssql-databaseAmazon Aurora DSQLaws-aurora-dsqlawssql-databaseOracle Database@AWSaws-oracle-databaseawssql-databaseAmazon RDSaws-rdsawssql-databaseAmazon RDS Customaws-rds-customawssql-databaseAzure Database for MySQLazure-database-for-mysqlazuresql-databaseAzure Database for PostgreSQLazure-database-for-postgresqlazuresql-databaseAzure HorizonDBazure-horizondbazuresql-databaseOracle AI Database@Azureazure-oracle-databaseazuresql-databaseAzure SQL Databaseazure-sqlazuresql-databaseAzure SQL Managed Instanceazure-sql-managed-instanceazuresql-databaseSQL Server on Azure Virtual Machinesazure-sql-server-vmazuresql-databaseCituscitussql-databaseCockroachDBcockroachdbsql-databaseCockroachDB Cloudcockroachdb-cloudsql-databaseDatomicdatomicsql-databaseIBM Db2db2sql-databaseEDB Postgres Advanced Serveredb-postgressql-databaseClaris FileMaker Serverfilemakersql-databaseFirebirdfirebirdsql-databaseIBM Informixinformixsql-databaseActian Ingresingressql-databaseInterBaseinterbasesql-databaseInterSystems IRISintersystems-irissql-databaseMariaDB Servermariadbsql-databaseMySQLmysqlsql-databaseNeonneonsql-databaseOceanBase Databaseoceanbasesql-databaseProgress OpenEdgeopenedgesql-databaseOracle Databaseoracle-dbsql-databasePlanetScaleplanetscalesql-databasePostGISpostgissql-databasePostgreSQLpostgressql-databaseRelational databaserelational-databasesql-databaseSAP Adaptive Server Enterprisesap-asesql-databaseSAP HANAsap-hanasql-database
and 35 more → SQL database page
Source
# yaml-language-server: $schema=../../schema/component.schema.json
# D1: a serverless SQLite database for Workers. "D1 - Limits" gives 10 GB per database and 30 days of
# Time Travel point-in-time recovery on paid plans, which is on without configuration; "Read
# replication" is off until it is turned on, and gives sequential consistency through the Sessions API.
schemaVersion: "1"
type: "component"
id: "cloudflare-d1"
kind: "sql-database"
provider: "cloudflare"
docs: "https://developers.cloudflare.com/d1/platform/limits/"
defaults:
  managed: true
  backupEnabled: true
  backupRetentionDays: 30
  replication: "none"
  sharded: false
  multiWriter: false
  distributed: false
properties:
  readReplication:
    type: "boolean"
    default: false
  maxDatabaseSizeGb:
    type: "integer"
    default: 10
  maxColumnsPerTable:
    type: "integer"
    default: 100
  locationHint:
    type: "enum"
    values: ["enam", "wnam", "weur", "eeur", "apac", "oc"]
  maxDatabasesPerAccount:
    type: "integer"
    default: 50000

The same page as markdown, for an agent: /catalogue/components/cloudflare-d1.md