From 9e1cd8b4a8651ad565ab07597f6e4d11fec12384 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:27:02 +0100 Subject: [PATCH 1/8] Add D1 vs Hyperdrive --- src/content/docs/workers/platform/storage-options.mdx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index b1463cbad024c37..43543be15eddd70 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -209,4 +209,15 @@ The new beta version of Durable Objects is available where each Durable Object h ::: +## D1 vs Hyperdrive + +D1 is a standalone, serverless database that provides a SQL API to store and access your relational data. + +Hyperdrive is a service that improves the performance of your existing, regional PostgreSQL databases, optimizing them for global data access from Workers. + +If you are building a new project on Workers or are considering migrating your data, use D1. + +If you are building a Workers project with an existing PostgreSQL database, use Hyperdrive. + +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/). From f57dcfade93d17b72bd66650d97d93b90f60c32d Mon Sep 17 00:00:00 2001 From: Thomas Gauvin Date: Thu, 10 Oct 2024 16:28:45 +0100 Subject: [PATCH 2/8] thomasgauvin: nit --- src/content/partials/workers/storage-products-table.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/content/partials/workers/storage-products-table.mdx b/src/content/partials/workers/storage-products-table.mdx index 2ac14eef2869381..7fee3d5652b9019 100644 --- a/src/content/partials/workers/storage-products-table.mdx +++ b/src/content/partials/workers/storage-products-table.mdx @@ -1,6 +1,5 @@ --- {} - --- | Use-case | Product | Ideal for | @@ -12,4 +11,4 @@ | Global co-ordination | [Durable Objects](/durable-objects/) | Building collaborative applications; global co-ordination across clients; strongly consistent, transactional storage. | | Vector search (database) | [Vectorize](/vectorize/) | Storing [embeddings](/workers-ai/models/#text-embeddings) from AI models for semantic search and classification tasks. | | Task processing & batching | [Queues](/queues/) | Background job processing (emails, notifications, APIs) and log processing/batching. | -| Connect to an existing database | [Hyperdrive](/hyperdrive/) | Connecting to an existing database in a cloud or on-prem. | +| Connect to an existing database | [Hyperdrive](/hyperdrive/) | Connecting to an existing database in a cloud or on-premise. | From e4ff9d2acde5785c1e09cbcd81223f581f624b5d Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Fri, 11 Oct 2024 11:18:23 +0100 Subject: [PATCH 3/8] Update src/content/docs/workers/platform/storage-options.mdx Co-authored-by: Vy Ton --- src/content/docs/workers/platform/storage-options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index 43543be15eddd70..efa87176441a5af 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -211,7 +211,7 @@ The new beta version of Durable Objects is available where each Durable Object h ## D1 vs Hyperdrive -D1 is a standalone, serverless database that provides a SQL API to store and access your relational data. +D1 is a standalone, serverless database that provides a SQL API, using SQLite's SQL semantics, to store and access your relational data. Hyperdrive is a service that improves the performance of your existing, regional PostgreSQL databases, optimizing them for global data access from Workers. From 7433cce8498f542abb0ecf9aec3a79fbaf898f24 Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Mon, 14 Oct 2024 10:19:26 +0100 Subject: [PATCH 4/8] Actioning feedback. --- .../docs/workers/platform/storage-options.mdx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index efa87176441a5af..cc2986ef3cfeb30 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -211,13 +211,18 @@ The new beta version of Durable Objects is available where each Durable Object h ## D1 vs Hyperdrive -D1 is a standalone, serverless database that provides a SQL API, using SQLite's SQL semantics, to store and access your relational data. +D1 is a standalone, serverless database that provides a SQL API, using SQLite's SQL semantics, to store and access your relational data. Hyperdrive is a service that improves the performance of your existing, regional PostgreSQL databases, optimizing them for global data access from Workers. -If you are building a new project on Workers or are considering migrating your data, use D1. +- If you are building a new project on Workers or are considering migrating your data, use D1. +- If you are building a Workers project with an existing PostgreSQL database, use Hyperdrive. +- If your database exceeds 10 GB (the maximum size for a D1 database), consider splitting the database to multiple, smaller D1 databases, or use your existing PostgreSQL database with Hyperdrive. -If you are building a Workers project with an existing PostgreSQL database, use Hyperdrive. +:::caution -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/). +You cannot use D1 with Hyperdrive. +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/). + +::: From 12a79f343f01d38336dc95c9955cab046425574d Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Wed, 16 Oct 2024 09:24:06 +0100 Subject: [PATCH 5/8] Update src/content/docs/workers/platform/storage-options.mdx Co-authored-by: Vy Ton --- src/content/docs/workers/platform/storage-options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index cc2986ef3cfeb30..664f80da5088247 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -213,7 +213,7 @@ The new beta version of Durable Objects is available where each Durable Object h D1 is a standalone, serverless database that provides a SQL API, using SQLite's SQL semantics, to store and access your relational data. -Hyperdrive is a service that improves the performance of your existing, regional PostgreSQL databases, optimizing them for global data access from Workers. +Hyperdrive is a service that lets you connect your existing, regional PostgreSQL databases and improves database performance by optimizing them for global data access from Workers. - If you are building a new project on Workers or are considering migrating your data, use D1. - If you are building a Workers project with an existing PostgreSQL database, use Hyperdrive. From d9d4349f9060bdb89d6388423a21146b8a0a84e0 Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Wed, 16 Oct 2024 09:24:37 +0100 Subject: [PATCH 6/8] Update src/content/docs/workers/platform/storage-options.mdx Co-authored-by: Vy Ton --- src/content/docs/workers/platform/storage-options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index 664f80da5088247..a5a09d86dd4ba05 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -217,7 +217,7 @@ Hyperdrive is a service that lets you connect your existing, regional PostgreSQL - If you are building a new project on Workers or are considering migrating your data, use D1. - If you are building a Workers project with an existing PostgreSQL database, use Hyperdrive. -- If your database exceeds 10 GB (the maximum size for a D1 database), consider splitting the database to multiple, smaller D1 databases, or use your existing PostgreSQL database with Hyperdrive. +- If your working data size exceeds 10 GB (the maximum size for a D1 database), consider splitting the database to multiple, smaller D1 databases. :::caution From 97a6b345b72a559044f39bd0678a040a04c21952 Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Fri, 18 Oct 2024 14:27:22 +0100 Subject: [PATCH 7/8] Apply suggestions from code review Co-authored-by: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> --- src/content/docs/workers/platform/storage-options.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index a5a09d86dd4ba05..980e74cd34cf7ec 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -213,13 +213,13 @@ The new beta version of Durable Objects is available where each Durable Object h D1 is a standalone, serverless database that provides a SQL API, using SQLite's SQL semantics, to store and access your relational data. -Hyperdrive is a service that lets you connect your existing, regional PostgreSQL databases and improves database performance by optimizing them for global data access from Workers. +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. - If you are building a new project on Workers or are considering migrating your data, use D1. - If you are building a Workers project with an existing PostgreSQL database, use Hyperdrive. - If your working data size exceeds 10 GB (the maximum size for a D1 database), consider splitting the database to multiple, smaller D1 databases. -:::caution +:::note You cannot use D1 with Hyperdrive. From 6cca59c3ed3716f08fab06f6580b1dca5edb496f Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Fri, 18 Oct 2024 14:33:57 +0100 Subject: [PATCH 8/8] Update src/content/docs/workers/platform/storage-options.mdx Co-authored-by: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> --- src/content/docs/workers/platform/storage-options.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index 980e74cd34cf7ec..d08b1654a34b1a5 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -217,7 +217,6 @@ Hyperdrive is a service that lets you connect to your existing, regional Postgre - If you are building a new project on Workers or are considering migrating your data, use D1. - If you are building a Workers project with an existing PostgreSQL database, use Hyperdrive. -- If your working data size exceeds 10 GB (the maximum size for a D1 database), consider splitting the database to multiple, smaller D1 databases. :::note