diff --git a/src/content/docs/d1/best-practices/read-replication.mdx b/src/content/docs/d1/best-practices/read-replication.mdx index f1126039813..c5c1f4fcbb8 100644 --- a/src/content/docs/d1/best-practices/read-replication.mdx +++ b/src/content/docs/d1/best-practices/read-replication.mdx @@ -10,7 +10,9 @@ import { GlossaryTooltip, Details, GitHubCode, APIRequest, Tabs, TabItem, TypeSc D1 read replication can lower latency for read queries and scale read throughput by adding read-only database copies, called read replicas, across regions globally closer to clients. -Your application can use read replicas with D1 [Sessions API](/d1/worker-api/d1-database/#withsession). A session encapsulates all the queries from one logical session for your application. For example, a session may correspond to all queries coming from a particular web browser session. All queries within a session read from a database instance which is as up-to-date as your query needs it to be. Sessions API ensures [sequential consistency](/d1/best-practices/read-replication/#replica-lag-and-consistency-model) for all queries in a session. +To use read replication, you must use the [D1 Sessions API](/d1/worker-api/d1-database/#withsession), otherwise all queries will continue to be executed only by the primary database. + +A session encapsulates all the queries from one logical session for your application. For example, a session may correspond to all queries coming from a particular web browser session. All queries within a session read from a database instance which is as up-to-date as your query needs it to be. Sessions API ensures [sequential consistency](/d1/best-practices/read-replication/#replica-lag-and-consistency-model) for all queries in a session. To checkout D1 read replication, deploy the following Worker code using Sessions API, which will prompt you to create a D1 database and enable read replication on said database. diff --git a/src/content/docs/d1/worker-api/d1-database.mdx b/src/content/docs/d1/worker-api/d1-database.mdx index 2341b6f0449..4fa355f349b 100644 --- a/src/content/docs/d1/worker-api/d1-database.mdx +++ b/src/content/docs/d1/worker-api/d1-database.mdx @@ -274,7 +274,8 @@ const session = env.DB.withSession(""); #### Guidance -You can return the last encountered `bookmark` for a given Session using [`session.getBookmark()`](/d1/worker-api/d1-database/#getbookmark). +- To use read replication, you have to use the D1 Sessions API, otherwise all queries will continue to be executed only by the primary database. +- You can return the last encountered `bookmark` for a given Session using [`session.getBookmark()`](/d1/worker-api/d1-database/#getbookmark). ## `D1DatabaseSession` methods