Skip to content

Commit 11d1e3c

Browse files
thomasgauvinOxyjunvy-ton
authored
Add D1 vs Hyperdrive (#17465)
* Add D1 vs Hyperdrive * thomasgauvin: nit * Update src/content/docs/workers/platform/storage-options.mdx Co-authored-by: Vy Ton <[email protected]> * Actioning feedback. * Update src/content/docs/workers/platform/storage-options.mdx Co-authored-by: Vy Ton <[email protected]> * Update src/content/docs/workers/platform/storage-options.mdx Co-authored-by: Vy Ton <[email protected]> * Apply suggestions from code review Co-authored-by: Thomas Gauvin <[email protected]> * Update src/content/docs/workers/platform/storage-options.mdx Co-authored-by: Thomas Gauvin <[email protected]> --------- Co-authored-by: Jun Lee <[email protected]> Co-authored-by: Vy Ton <[email protected]>
1 parent 3c1a39b commit 11d1e3c

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/content/docs/workers/platform/storage-options.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,19 @@ The new beta version of Durable Objects is available where each Durable Object h
209209

210210
:::
211211

212+
## D1 vs Hyperdrive
212213

214+
D1 is a standalone, serverless database that provides a SQL API, using SQLite's SQL semantics, to store and access your relational data.
215+
216+
Hyperdrive is a service that lets you connect to your existing, regional PostgreSQL databases and improves database performance by optimizing them for global, scalable data access from Workers.
217+
218+
- If you are building a new project on Workers or are considering migrating your data, use D1.
219+
- If you are building a Workers project with an existing PostgreSQL database, use Hyperdrive.
220+
221+
:::note
222+
223+
You cannot use D1 with Hyperdrive.
224+
225+
However, D1 does not need to be used with Hyperdrive because it does not have slow connection setups which would benefit from Hyperdrive's connection pooling. D1 data can also be cached within Workers using the [Cache API](/workers/runtime-apis/cache/).
226+
227+
:::

src/content/partials/workers/storage-products-table.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
{}
3-
43
---
54

65
| Use-case | Product | Ideal for |
@@ -12,4 +11,4 @@
1211
| Global co-ordination | [Durable Objects](/durable-objects/) | Building collaborative applications; global co-ordination across clients; strongly consistent, transactional storage. |
1312
| Vector search (database) | [Vectorize](/vectorize/) | Storing [embeddings](/workers-ai/models/#text-embeddings) from AI models for semantic search and classification tasks. |
1413
| Task processing & batching | [Queues](/queues/) | Background job processing (emails, notifications, APIs) and log processing/batching. |
15-
| Connect to an existing database | [Hyperdrive](/hyperdrive/) | Connecting to an existing database in a cloud or on-prem. |
14+
| Connect to an existing database | [Hyperdrive](/hyperdrive/) | Connecting to an existing database in a cloud or on-premise. |

0 commit comments

Comments
 (0)