diff --git a/src/content/docs/d1/platform/alpha-migration.mdx b/src/content/docs/d1/platform/alpha-migration.mdx index 2ea032f6873093..788ac9ac11e2c7 100644 --- a/src/content/docs/d1/platform/alpha-migration.mdx +++ b/src/content/docs/d1/platform/alpha-migration.mdx @@ -2,7 +2,7 @@ pcx_content_type: concept title: Alpha database migration guide sidebar: - order: 2 + order: 3 --- :::caution diff --git a/src/content/docs/d1/platform/limits.mdx b/src/content/docs/d1/platform/limits.mdx index 189784e95ab237..c9b5fc30c14c37 100644 --- a/src/content/docs/d1/platform/limits.mdx +++ b/src/content/docs/d1/platform/limits.mdx @@ -54,19 +54,4 @@ Cloudflare also offers other storage solutions such as [Workers KV](/kv/api/), [ Frequently asked questions related to D1 limits: -### How much work can a D1 database do? - -D1 is designed for horizontal scale out across multiple, smaller (10 GB) databases, such as per-user, per-tenant or per-entity databases. D1 allows you to build applications with thousands of databases at no extra cost for isolating with multiple databases, as the pricing is based only on query and storage costs. - -- Each D1 database can store up to 10 GB of data, and you can create up to thousands of separate D1 databases. This allows you to split a single monolithic database into multiple, smaller databases, thereby isolating application data by user, customer, or tenant. -- SQL queries over a smaller working data set can be more efficient and performant while improving data isolation. - -:::caution -Note that the 10 GB limit of a D1 database cannot be further increased. -::: - -### How many simultaneous connections can a Worker open to D1? - -You can open up to six connections (to D1) simultaneously for each invocation of your Worker. - -For more information on a Worker's simultaneous connections, refer to [Simultaneous open connections](/workers/platform/limits/#simultaneous-open-connections). + \ No newline at end of file diff --git a/src/content/docs/d1/platform/pricing.mdx b/src/content/docs/d1/platform/pricing.mdx index b8a77fc2f021b5..55be517fb81702 100644 --- a/src/content/docs/d1/platform/pricing.mdx +++ b/src/content/docs/d1/platform/pricing.mdx @@ -21,51 +21,4 @@ D1 bills based on: Frequently asked questions related to D1 pricing: -### Will D1 always have a Free plan? - -Yes, the [Workers Free plan](/workers/platform/pricing/#workers) will always include the ability to prototype and experiment with D1 for free. - -### What happens if I exceed the daily limits on reads and writes, or the total storage limit, on the Free plan? - -When your account hits the daily read and/or write limits, you will not be able to run queries against D1. D1 API will return errors to your client indicating that your daily limits have been exceeded. Once you have reached your included storage limit, you will need to delete unused databases or clean up stale data before you can insert new data, create or alter tables or create indexes and triggers. - -Upgrading to the Workers Paid plan will remove these limits, typically within minutes. - -### What happens if I exceed the monthly included reads, writes and/or storage on the paid tier? - -You will be billed for the additional reads, writes and storage according to [D1's pricing metrics](#billing-metrics). - -### How can I estimate my (eventual) bill? - -Every query returns a `meta` object that contains a total count of the rows read (`rows_read`) and rows written (`rows_written`) by that query. For example, a query that performs a full table scan (for instance, `SELECT * FROM users`) from a table with 5000 rows would return a `rows_read` value of `5000`: - -```json -"meta": { - "duration": 0.20472300052642825, - "size_after": 45137920, - "rows_read": 5000, - "rows_written": 0 -} -``` - -These are also included in the D1 [Cloudflare dashboard](https://dash.cloudflare.com) and the [analytics API](/d1/observability/metrics-analytics/), allowing you to attribute read and write volumes to specific databases, time periods, or both. - -### Does D1 charge for data transfer / egress? - -No. - -### Does D1 charge additional for additional compute? - -D1 itself does not charge for additional compute. Workers querying D1 and computing results: for example, serializing results into JSON and/or running queries, are billed per [Workers pricing](/workers/platform/pricing/#workers), in addition to your D1 specific usage. - -### Do queries I run from the dashboard or Wrangler (the CLI) count as billable usage? - -Yes, any queries you run against your database, including inserting (`INSERT`) existing data into a new database, table scans (`SELECT * FROM table`), or creating indexes count as either reads or writes. - -### Can I use an index to reduce the number of rows read by a query? - -Yes, you can use an index to reduce the number of rows read by a query. [Creating indexes](/d1/best-practices/use-indexes/) for your most queried tables and filtered columns reduces how much data is scanned and improves query performance at the same time. If you have a read-heavy workload (most common), this can be particularly advantageous. Writing to columns referenced in an index will add at least one (1) additional row written to account for updating the index, but this is typically offset by the reduction in rows read due to the benefits of an index. - -### Does a freshly created database, and/or an empty table with no rows, contribute to my storage? - -Yes, although minimal. An empty table consumes at least a few kilobytes, based on the number of columns (table width) in the table. An empty database consumes approximately 12 KB of storage. + diff --git a/src/content/docs/d1/platform/release-notes.mdx b/src/content/docs/d1/platform/release-notes.mdx index a5dccb0a376f27..15519f08efd2b6 100644 --- a/src/content/docs/d1/platform/release-notes.mdx +++ b/src/content/docs/d1/platform/release-notes.mdx @@ -4,7 +4,7 @@ title: Release notes release_notes_file_name: - d1 sidebar: - order: 4 + order: 5 --- import { ProductReleaseNotes } from "~/components"; diff --git a/src/content/docs/d1/platform/storage-options.mdx b/src/content/docs/d1/platform/storage-options.mdx index 5e7cacd55d3f07..f7215d47398600 100644 --- a/src/content/docs/d1/platform/storage-options.mdx +++ b/src/content/docs/d1/platform/storage-options.mdx @@ -3,6 +3,6 @@ pcx_content_type: navigation title: Choose a data or storage product external_link: /workers/platform/storage-options/ sidebar: - order: 3 + order: 4 --- diff --git a/src/content/docs/d1/reference/faq.mdx b/src/content/docs/d1/reference/faq.mdx new file mode 100644 index 00000000000000..d20f033b189386 --- /dev/null +++ b/src/content/docs/d1/reference/faq.mdx @@ -0,0 +1,17 @@ +--- +title: FAQs +pcx_content_type: faq +sidebar: + order: 10 + +--- + +import { Render } from "~/components"; + +## Pricing + + + +## Limits + + \ No newline at end of file diff --git a/src/content/docs/durable-objects/reference/faq.mdx b/src/content/docs/durable-objects/reference/faq.mdx index a8772f670a0c48..b3a0b399fed7b5 100644 --- a/src/content/docs/durable-objects/reference/faq.mdx +++ b/src/content/docs/durable-objects/reference/faq.mdx @@ -1,5 +1,5 @@ --- -title: Frequently Asked Questions +title: FAQs pcx_content_type: concept sidebar: order: 12 diff --git a/src/content/partials/d1/faq-limits.mdx b/src/content/partials/d1/faq-limits.mdx new file mode 100644 index 00000000000000..bbadefb7e45af0 --- /dev/null +++ b/src/content/partials/d1/faq-limits.mdx @@ -0,0 +1,20 @@ +--- +{} +--- + +### How much work can a D1 database do? + +D1 is designed for horizontal scale out across multiple, smaller (10 GB) databases, such as per-user, per-tenant or per-entity databases. D1 allows you to build applications with thousands of databases at no extra cost for isolating with multiple databases, as the pricing is based only on query and storage costs. + +- Each D1 database can store up to 10 GB of data, and you can create up to thousands of separate D1 databases. This allows you to split a single monolithic database into multiple, smaller databases, thereby isolating application data by user, customer, or tenant. +- SQL queries over a smaller working data set can be more efficient and performant while improving data isolation. + +:::caution +Note that the 10 GB limit of a D1 database cannot be further increased. +::: + +### How many simultaneous connections can a Worker open to D1? + +You can open up to six connections (to D1) simultaneously for each invocation of your Worker. + +For more information on a Worker's simultaneous connections, refer to [Simultaneous open connections](/workers/platform/limits/#simultaneous-open-connections). diff --git a/src/content/partials/d1/faq-pricing.mdx b/src/content/partials/d1/faq-pricing.mdx new file mode 100644 index 00000000000000..70f2dc0d38c389 --- /dev/null +++ b/src/content/partials/d1/faq-pricing.mdx @@ -0,0 +1,52 @@ +--- +{} +--- + +### Will D1 always have a Free plan? + +Yes, the [Workers Free plan](/workers/platform/pricing/#workers) will always include the ability to prototype and experiment with D1 for free. + +### What happens if I exceed the daily limits on reads and writes, or the total storage limit, on the Free plan? + +When your account hits the daily read and/or write limits, you will not be able to run queries against D1. D1 API will return errors to your client indicating that your daily limits have been exceeded. Once you have reached your included storage limit, you will need to delete unused databases or clean up stale data before you can insert new data, create or alter tables or create indexes and triggers. + +Upgrading to the Workers Paid plan will remove these limits, typically within minutes. + +### What happens if I exceed the monthly included reads, writes and/or storage on the paid tier? + +You will be billed for the additional reads, writes and storage according to [D1's pricing metrics](#billing-metrics). + +### How can I estimate my (eventual) bill? + +Every query returns a `meta` object that contains a total count of the rows read (`rows_read`) and rows written (`rows_written`) by that query. For example, a query that performs a full table scan (for instance, `SELECT * FROM users`) from a table with 5000 rows would return a `rows_read` value of `5000`: + +```json +"meta": { + "duration": 0.20472300052642825, + "size_after": 45137920, + "rows_read": 5000, + "rows_written": 0 +} +``` + +These are also included in the D1 [Cloudflare dashboard](https://dash.cloudflare.com) and the [analytics API](/d1/observability/metrics-analytics/), allowing you to attribute read and write volumes to specific databases, time periods, or both. + +### Does D1 charge for data transfer / egress? + +No. + +### Does D1 charge additional for additional compute? + +D1 itself does not charge for additional compute. Workers querying D1 and computing results: for example, serializing results into JSON and/or running queries, are billed per [Workers pricing](/workers/platform/pricing/#workers), in addition to your D1 specific usage. + +### Do queries I run from the dashboard or Wrangler (the CLI) count as billable usage? + +Yes, any queries you run against your database, including inserting (`INSERT`) existing data into a new database, table scans (`SELECT * FROM table`), or creating indexes count as either reads or writes. + +### Can I use an index to reduce the number of rows read by a query? + +Yes, you can use an index to reduce the number of rows read by a query. [Creating indexes](/d1/best-practices/use-indexes/) for your most queried tables and filtered columns reduces how much data is scanned and improves query performance at the same time. If you have a read-heavy workload (most common), this can be particularly advantageous. Writing to columns referenced in an index will add at least one (1) additional row written to account for updating the index, but this is typically offset by the reduction in rows read due to the benefits of an index. + +### Does a freshly created database, and/or an empty table with no rows, contribute to my storage? + +Yes, although minimal. An empty table consumes at least a few kilobytes, based on the number of columns (table width) in the table. An empty database consumes approximately 12 KB of storage.