A replica is a continuously updated copy of your Vitess database. Replicas serve two main purposes:
They provide an additional source for your data to be queried.
They increase database availability by enabling fast failovers for maintenance or unexpected failure.
Before utilizing replicas for reducing load on the primary, it’s important to understand the trade-offs. For more information, see the Data consistency and replication lag section.
For information on replicas running in additional regions, see: Read-only regions.
PlanetScale replicas can be used to read data and reduce load on the primary. PlanetScale does not automatically route queries to replicas unless you explicitly use a replica credential or tell your application to do so.
1. Create a global replica credential (recommended)
With global replica credentials, you can have one credential that will automatically route queries to your branch’s replicas and read-only regions. If you do not have any read-only regions, it will route to the included replicas on your plan. If you do have any read-only regions, the queries will route to the closest replica out of your read-only region replicas and included failover replicas.To use this, create a new credential in the PlanetScale dashboard and select “Replica” as the connection type. You can then use the new credential’s connection string to setup a replica-only database
connection.If you have pscale installed locally, you can create a replica credential with the following command:
All queries made using this credential will be routed to the nearest replica, even as you add and remove read-only regions.To pin traffic to a specific read-only region instead, create a region-scoped password:
We do not recommend using this method to query replicas. If you are currently using this method, we recommend switching to method 1.
If you are not using a global replica credential, then, by default, all queries are served by the primary. However you may route any SELECT queries to replicas by issuing the following command on a connection:
USE @replica
Once this command is run, all subsequent SELECT queries on that connection will be served by your branch’s replicas instead of the primary node in your cluster. Please note that this does not send queries to any read-only regions, if you want to route queries all replicas, including read-only regions, you should use a global replica credential (method 1 above).
Replicas within PlanetScale are used to enable high availability of your database. This is a part of the reason all production branches in PlanetScale are provided at least one replica. In situations where the underlying hardware or service hosting the primary MySQL node fails, our system will automatically elect a new primary node from the available replicas and reroute traffic to that new primary. This process is know as reparenting and typically is all handled within milliseconds or seconds.Querying the primary during a reparent typically goes unnoticed, other than a bit of additional query latency.
This is because Vitess buffers queries during this time.
You can incorporate retry logic into your application to handle the rare instances where an issue arises during reparenting.When querying a replica during a reparent, you may encounter this error:
no healthy tablet available for 'keyspace:"${keyspace}" shard:"${shard}" tablet_type:REPLICA'
Incorporating retry logic into your application can help with this scenario as well.
In cloud architecture, regions are further broken down into data centers known as availability zones (or AZs for short). For example, the us-east-1 region on AWS contains 6 default AZs available to customers starting with us-east-1a through us-east-1f. The infrastructure for all Base plan and Enterprise PlanetScale databases are distributed across 3 availability zones. In the instance of an AZ failure, your database will auto failover to an available AZ.
Whenever data is updated (INSERT, UPDATE, DELETE) on the primary node, those changes are synchronized to the replicas shortly after. The delay between when a primary is updated and the changes are applied to the replica is known as replication lag. Your databases replication lag is viewable on your database dashboard. Replication lag can also be viewed on Datadog if you set up the PlanetScale - Datadog integration.In Datadog, you can use the following formula to set alerts for replication lag:
Make sure you replace <DATABASE_NAME> with your PlanetScale database name and <MAIN> with the name of the branch for which you’d like to track replication lag.It is important to be aware of replication lag whenever querying data from your replicas. For example, if you make an update and then immediately try to query for that updated data via a replica, it may not be available yet due to replication lag.
Replicas are useful for offloading read-heavy workloads from the primary node. By using replicas, you can distribute the read load across multiple nodes, which can help improve the performance of your application. Some examples of where you might want to query a replica are scheduled jobs, analytics jobs, search features, or aggregate queries. Replicas can also be used to provide a read-only view of your data to users or applications that do not need to write data, such as when a user is logged out or writing one-off queries for debugging purposes.
We use replicas for every production database branch. The number of replicas for a given database depends on the selected plan for that database:
Base plan — Base plan databases include 2 replicas per production branch distributed across multiple AZs in a given region.
Enterprise — The Enterprise plan is customizable to fit the needs of your organization, and as such can have as many replicas as needed.
Read-only regions also run replicas, hosted in a different geographical region. Each read-only region has its own cluster size and replica count, configured per keyspace independently of the primary region. It is important to note that the MySQL nodes in read-only regions are replicas intended only for reading data and are not eligible for failover if the primary node experiences an outage.
Development branches DO NOT have replicas as they are intended for development only and are not designed with the same resiliency as production branches.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"PlanetScale","description":"PlanetScale is a relational database platform for Vitess, Neki, and Postgres that gives you scale, performance, and reliability without sacrificing developer experience.","colors":{"primary":"#0e73cc","light":"#47b7f8","dark":"#f15817"},"logo":{"light":"https://mintcdn.com/planetscale-2/xUilVHToUFALai8a/logo/light.png?fit=max\u0026auto=format\u0026n=xUilVHToUFALai8a\u0026q=85\u0026s=cccd3c9fc813c01b899ab7af15a115b1","dark":"https://mintcdn.com/planetscale-2/xUilVHToUFALai8a/logo/dark.png?fit=max\u0026auto=format\u0026n=xUilVHToUFALai8a\u0026q=85\u0026s=4153888dc0ef54ddc3464738a2d7ee6e","href":"https://planetscale.com"},"favicon":"https://mintcdn.com/planetscale-2/DJh9Bv1aUZHTVDnK/favicon.svg?fit=max\u0026auto=format\u0026n=DJh9Bv1aUZHTVDnK\u0026q=85\u0026s=cc6ec9d8d0deb3450719bb4b5b6df73a","background":{"color":{"light":"#fafafa","dark":"#111111"}},"navbar":{"links":[{"href":"https://auth.planetscale.com/sign-in","label":"Log in"},{"href":"https://auth.planetscale.com/sign-up","label":"Get started"}],"primary":{"type":"button","label":"Get in touch","href":"https://planetscale.com/contact"}},"footer":{"socials":{"x":"https://twitter.com/planetscale","github":"https://github.com/planetscale","linkedin":"https://www.linkedin.com/company/planetscale","youtube":"https://www.youtube.com/c/PlanetScale","discord":"https://pscale.link/community","facebook":"https://www.facebook.com/planetscaledata"}},"seo":{"metatags":{"canonical":"https://planetscale.com/docs"}},"fonts":{"heading":{"family":"Inter"},"body":{"family":"Inter"}},"integrations":{"segment":{"key":"9Ujczlrndco2w8fcFAakL0FT4bsJCCh3"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Blog","icon":"newspaper","href":"https://planetscale.com/blog"},{"anchor":"Contact Us","icon":"headset","href":"https://planetscale.com/contact"},{"anchor":"Status","icon":"signal","href":"https://www.planetscalestatus.com/"},{"anchor":"Benchmarks","icon":"chart-line","href":"https://planetscale.com/benchmarks"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"planetscale-2","hasAudioNarration":false,"actualSubdomain":"planetscale-2","customDomains":["planetscale.com"],"gitSource":{"type":"github","owner":"planetscale","repo":"www","deployBranch":"main","contentDirectory":"content/mintlify/docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae4bbcf6d3c0060a25eeaab","collectionId":"049ef4be-45cb-4471-af55-3e8b42112ffe","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae4bbcf6d3c0060a25eeaab"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae4cefc4c4a3f4f5e4b3a5b","clientVersion":"0.0.4043","searchFilterCounts":[{"language":"default","tag":"Platform","count":288},{"language":"default","tag":"API Reference","count":268},{"language":"default","tag":"Vitess","count":184},{"language":"default","tag":"Postgres","count":108},{"language":"default","tag":"General API endpoints","count":97},{"language":"default","tag":"Neki","count":58},{"language":"default","tag":"Guides","count":58},{"language":"default","tag":"Vitess API endpoints","count":56},{"language":"default","tag":"Postgres API endpoints","count":51},{"language":"default","tag":"Neki API endpoints","count":50}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"type":"link","url":"https://planetscale.com/contact?initial=support"}},"basePath":"/docs","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#content-container{column-gap:2rem}.nav-tabs{column-gap:.5em}.nav-tabs-item{padding:0 8px}.eyebrow,.light #navigation-items .text-gray-700,.nav-tabs a{color:#616161}#navigation-items .text-primary,#topbar-cta-button .text-white,#topbar-cta-button svg,.nav-tabs a.text-primary{color:#1a1a1a}.nav-tabs a.text-primary .bg-primary{background-color:#1a1a1a;left:0}.dark .nav-tabs a[href='/docs/vitess'i].text-primary,.nav-tabs a[href='/docs/vitess'i].text-primary{color:#f15817}.dark .nav-tabs a[href='/docs/vitess'i].text-primary .bg-primary,.nav-tabs a[href='/docs/vitess'i].text-primary .bg-primary{background-color:#f15817}.nav-tabs a[href='/docs/postgres'i].text-primary{color:#0e73cc}.nav-tabs a[href='/docs/postgres'i].text-primary .bg-primary{background-color:#0e73cc}.nav-tabs a[href='/docs/neki'i].text-primary{color:#8f7200}.nav-tabs a[href='/docs/neki'i].text-primary .bg-primary{background-color:#8f7200}.dark .nav-tabs a{color:#a1a1a1}.dark #navigation-items .text-primary,.dark .nav-tabs a.text-primary{color:#fafafa}.dark .nav-tabs a.text-primary .bg-primary{background-color:#fafafa}.dark .nav-tabs a[href='/docs/postgres'i].text-primary{color:#47b7f8}.dark .nav-tabs a[href='/docs/postgres'i].text-primary .bg-primary{background-color:#47b7f8}.dark .nav-tabs a[href='/docs/neki'i].text-primary{color:#fbca00}.dark .nav-tabs a[href='/docs/neki'i].text-primary .bg-primary{background-color:#fbca00}.prose:is(.dark *){color:#c1c1c1}.prose :where(a):not(:where([class~='not-prose'], [class~='not-prose'] *)){color:#0e73cc;font-weight:500}.dark .prose :where(a):not(:where(.not-prose, .not-prose *)){color:#47b7f8}.dark .eyebrow{color:#a1a1a1}@media (min-width:1024px){#content-container{padding-top:2rem;padding-right:2rem;padding-left:2.5rem}}#topbar-cta-button a>span{background-color:#fbca00}.group:hover span{opacity:1!important}.bg-primary\\/10{background-color:rgba(129,129,129,.1)}.dark .bg-primary\\/10{background-color:rgba(255,255,255,.1)}body[data-current-path^='/vitess'] svg.bg-primary{background-color:#f15817}body[data-current-path^='/vitess'] .border-primary{border-color:#f15817}body[data-current-path^='/vitess'] #table-of-contents-content .text-primary,body[data-current-path^='/vitess'] .eyebrow{color:#f15817}body[data-current-path^='/vitess'] .card-group a:hover{border-color:#f15817!important}body[data-current-path^='/postgres'] .eyebrow{color:#0e73cc}.dark body[data-current-path^='/postgres'] .eyebrow{color:#47b7f8}body[data-current-path^='/neki'] svg.bg-primary{background-color:#8f7200}body[data-current-path^='/neki'] [data-component-part=card-icon]{background-color:#fbca00}body[data-current-path^='/neki'] [data-component-part=card-icon] svg.bg-primary{background-color:#1a1a1a;transform:scale(.7);transform-origin:center}body[data-current-path^='/neki'] .border-primary{border-color:#8f7200}body[data-current-path^='/neki'] #table-of-contents-content .text-primary{color:#1a1a1a;background-color:transparent;border-color:#fbca00}body[data-current-path^='/neki'] .eyebrow{display:inline-flex;align-items:center;width:fit-content;height:auto;min-height:1.25rem;padding:0 .375rem;color:#1a1a1a;background-color:#fbca00}body[data-current-path^='/neki'] .eyebrow:empty,body[data-current-path^='/neki'] .eyebrow[data-empty]{display:none}.dark body[data-current-path^='/neki'] .card-group .card:hover,body[data-current-path^='/neki'] .card-group .card:hover{--primary:251 202 0;--primary-light:251 202 0;border-color:#fbca00!important}.dark body[data-current-path^='/neki'] [data-component-part=card-icon],.dark body[data-current-path^='/neki'] svg.bg-primary{background-color:#fbca00}.dark body[data-current-path^='/neki'] [data-component-part=card-icon] svg.bg-primary{background-color:#1a1a1a}.dark body[data-current-path^='/neki'] .border-primary{border-color:#fbca00}.dark body[data-current-path^='/neki'] #table-of-contents-content .text-primary{color:#fafafa;background-color:transparent;border-color:#fbca00}.dark body[data-current-path^='/neki'] .eyebrow{color:#1a1a1a;background-color:#fbca00}footer div:last-child{display:none}#header,#pagination a,[data-component-part=card-content-container],[data-component-part=frame-caption]{text-wrap:balance}.step:last-of-type [data-component-part=step-line]{opacity:0}"}],"page":{"pagePath":"vitess/scaling/replicas","slug":"/vitess/scaling/replicas","pageMetadata":{"title":"Database replicas","sidebarTitle":"Replicas","og:image":"images/og/vitess/scaling/replicas.png","description":null,"href":"/vitess/scaling/replicas"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];const __snippet_platformLabels_3vlljw={vitess:`Vitess`,postgres:`Postgres`,neki:`Neki`};const __snippet_combinedPlatformLabels_3vlljw={both:`Vitess and Postgres`,all:`Vitess, Neki, and Postgres`,\"postgres-neki\":`Postgres and Neki`};const __snippet_platformBadgeClassName_3vlljw=`inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-1 text-[13px] font-semibold leading-tight no-underline data-[engine=vitess]:data-[state=current]:border-[#ffc59b] data-[engine=vitess]:data-[state=current]:bg-[#ffe8d8] data-[engine=vitess]:data-[state=current]:text-[#672002] dark:data-[engine=vitess]:data-[state=current]:border-[#962d00] dark:data-[engine=vitess]:data-[state=current]:bg-[#3c1403] dark:data-[engine=vitess]:data-[state=current]:text-[#ffe8d8] data-[engine=vitess]:data-[state=link]:border-[#ffc59b] data-[engine=vitess]:data-[state=link]:bg-transparent data-[engine=vitess]:data-[state=link]:text-[#b83a05] dark:data-[engine=vitess]:data-[state=link]:border-[#962d00] dark:data-[engine=vitess]:data-[state=link]:bg-transparent dark:data-[engine=vitess]:data-[state=link]:text-[#ffc59b] data-[engine=postgres]:data-[state=current]:border-[#a9dffe] data-[engine=postgres]:data-[state=current]:bg-[#ddf2ff] data-[engine=postgres]:data-[state=current]:text-[#0e3682] dark:data-[engine=postgres]:data-[state=current]:border-[#144eb6] dark:data-[engine=postgres]:data-[state=current]:bg-[#08204e] dark:data-[engine=postgres]:data-[state=current]:text-[#ddf2ff] data-[engine=postgres]:data-[state=link]:border-[#a9dffe] data-[engine=postgres]:data-[state=link]:bg-transparent data-[engine=postgres]:data-[state=link]:text-[#0b6ec5] dark:data-[engine=postgres]:data-[state=link]:border-[#144eb6] dark:data-[engine=postgres]:data-[state=link]:bg-transparent dark:data-[engine=postgres]:data-[state=link]:text-[#73c7f9] data-[engine=neki]:data-[state=current]:border-[#fbca00] data-[engine=neki]:data-[state=current]:bg-[#fbca00] data-[engine=neki]:data-[state=current]:text-[#1a1a1a] dark:data-[engine=neki]:data-[state=current]:border-[#fbca00] dark:data-[engine=neki]:data-[state=current]:bg-[#fbca00] dark:data-[engine=neki]:data-[state=current]:text-[#1a1a1a] data-[engine=neki]:data-[state=link]:border-[#fbca00] data-[engine=neki]:data-[state=link]:bg-transparent data-[engine=neki]:data-[state=link]:text-[#8f7200] dark:data-[engine=neki]:data-[state=link]:border-[#fbca00] dark:data-[engine=neki]:data-[state=link]:bg-transparent dark:data-[engine=neki]:data-[state=link]:text-[#fbca00] data-[engine=both]:data-[state=current]:border-[#d4d4d4] data-[engine=both]:data-[state=current]:bg-[#f0f0f0] data-[engine=both]:data-[state=current]:text-[#3d3d3d] dark:data-[engine=both]:data-[state=current]:border-[#525252] dark:data-[engine=both]:data-[state=current]:bg-[#2a2a2a] dark:data-[engine=both]:data-[state=current]:text-[#e5e5e5]`;const __snippet_docsHref_3vlljw=path=>path.startsWith(`/`)?path:`/${path}`;const __snippet_PlatformAvailabilityBadges_3vlljw=({current,vitess,postgres,neki})=>{const _components={a:`a`,..._provideComponents()};if(__snippet_combinedPlatformLabels_3vlljw[current]){return _jsx(`div`,{className:`not-prose mint-mb-5 mint-flex mint-flex-wrap mint-items-center mint-gap-2`,role:`group`,\"aria-label\":`Platform availability`,children:_jsx(`span`,{\"data-engine\":`both`,\"data-state\":`current`,\"aria-current\":`true`,className:`mint-inline-flex mint-items-center mint-gap-1.5 mint-whitespace-nowrap mint-rounded-full mint-border mint-px-2.5 mint-py-1 mint-text-[13px] mint-font-semibold mint-leading-tight mint-no-underline data-[engine=vitess]:data-[state=current]:mint-border-[#ffc59b] data-[engine=vitess]:data-[state=current]:mint-bg-[#ffe8d8] data-[engine=vitess]:data-[state=current]:mint-text-[#672002] dark:data-[engine=vitess]:data-[state=current]:mint-border-[#962d00] dark:data-[engine=vitess]:data-[state=current]:mint-bg-[#3c1403] dark:data-[engine=vitess]:data-[state=current]:mint-text-[#ffe8d8] data-[engine=vitess]:data-[state=link]:mint-border-[#ffc59b] data-[engine=vitess]:data-[state=link]:mint-bg-transparent data-[engine=vitess]:data-[state=link]:mint-text-[#b83a05] dark:data-[engine=vitess]:data-[state=link]:mint-border-[#962d00] dark:data-[engine=vitess]:data-[state=link]:mint-bg-transparent dark:data-[engine=vitess]:data-[state=link]:mint-text-[#ffc59b] data-[engine=postgres]:data-[state=current]:mint-border-[#a9dffe] data-[engine=postgres]:data-[state=current]:mint-bg-[#ddf2ff] data-[engine=postgres]:data-[state=current]:mint-text-[#0e3682] dark:data-[engine=postgres]:data-[state=current]:mint-border-[#144eb6] dark:data-[engine=postgres]:data-[state=current]:mint-bg-[#08204e] dark:data-[engine=postgres]:data-[state=current]:mint-text-[#ddf2ff] data-[engine=postgres]:data-[state=link]:mint-border-[#a9dffe] data-[engine=postgres]:data-[state=link]:mint-bg-transparent data-[engine=postgres]:data-[state=link]:mint-text-[#0b6ec5] dark:data-[engine=postgres]:data-[state=link]:mint-border-[#144eb6] dark:data-[engine=postgres]:data-[state=link]:mint-bg-transparent dark:data-[engine=postgres]:data-[state=link]:mint-text-[#73c7f9] data-[engine=neki]:data-[state=current]:mint-border-[#fbca00] data-[engine=neki]:data-[state=current]:mint-bg-[#fbca00] data-[engine=neki]:data-[state=current]:mint-text-[#1a1a1a] dark:data-[engine=neki]:data-[state=current]:mint-border-[#fbca00] dark:data-[engine=neki]:data-[state=current]:mint-bg-[#fbca00] dark:data-[engine=neki]:data-[state=current]:mint-text-[#1a1a1a] data-[engine=neki]:data-[state=link]:mint-border-[#fbca00] data-[engine=neki]:data-[state=link]:mint-bg-transparent data-[engine=neki]:data-[state=link]:mint-text-[#8f7200] dark:data-[engine=neki]:data-[state=link]:mint-border-[#fbca00] dark:data-[engine=neki]:data-[state=link]:mint-bg-transparent dark:data-[engine=neki]:data-[state=link]:mint-text-[#fbca00] data-[engine=both]:data-[state=current]:mint-border-[#d4d4d4] data-[engine=both]:data-[state=current]:mint-bg-[#f0f0f0] data-[engine=both]:data-[state=current]:mint-text-[#3d3d3d] dark:data-[engine=both]:data-[state=current]:mint-border-[#525252] dark:data-[engine=both]:data-[state=current]:mint-bg-[#2a2a2a] dark:data-[engine=both]:data-[state=current]:mint-text-[#e5e5e5]`,children:__snippet_combinedPlatformLabels_3vlljw[current]})})}const paths={vitess,postgres,neki};const others=[`vitess`,`neki`,`postgres`].filter(engine=>engine!==current\u0026\u0026paths[engine]);const engines=__snippet_platformLabels_3vlljw[current]?[current,...others]:others;const only=engines.length===1;return _jsx(`div`,{className:`not-prose mint-mb-5 mint-flex mint-flex-wrap mint-items-center mint-gap-2`,role:`group`,\"aria-label\":`Platform availability`,children:engines.map(engine=>{const label=only?`${__snippet_platformLabels_3vlljw[engine]} only`:__snippet_platformLabels_3vlljw[engine];if(engine===current){return _jsx(`span`,{\"data-engine\":engine,\"data-state\":`current`,\"aria-current\":`true`,className:`mint-inline-flex mint-items-center mint-gap-1.5 mint-whitespace-nowrap mint-rounded-full mint-border mint-px-2.5 mint-py-1 mint-text-[13px] mint-font-semibold mint-leading-tight mint-no-underline data-[engine=vitess]:data-[state=current]:mint-border-[#ffc59b] data-[engine=vitess]:data-[state=current]:mint-bg-[#ffe8d8] data-[engine=vitess]:data-[state=current]:mint-text-[#672002] dark:data-[engine=vitess]:data-[state=current]:mint-border-[#962d00] dark:data-[engine=vitess]:data-[state=current]:mint-bg-[#3c1403] dark:data-[engine=vitess]:data-[state=current]:mint-text-[#ffe8d8] data-[engine=vitess]:data-[state=link]:mint-border-[#ffc59b] data-[engine=vitess]:data-[state=link]:mint-bg-transparent data-[engine=vitess]:data-[state=link]:mint-text-[#b83a05] dark:data-[engine=vitess]:data-[state=link]:mint-border-[#962d00] dark:data-[engine=vitess]:data-[state=link]:mint-bg-transparent dark:data-[engine=vitess]:data-[state=link]:mint-text-[#ffc59b] data-[engine=postgres]:data-[state=current]:mint-border-[#a9dffe] data-[engine=postgres]:data-[state=current]:mint-bg-[#ddf2ff] data-[engine=postgres]:data-[state=current]:mint-text-[#0e3682] dark:data-[engine=postgres]:data-[state=current]:mint-border-[#144eb6] dark:data-[engine=postgres]:data-[state=current]:mint-bg-[#08204e] dark:data-[engine=postgres]:data-[state=current]:mint-text-[#ddf2ff] data-[engine=postgres]:data-[state=link]:mint-border-[#a9dffe] data-[engine=postgres]:data-[state=link]:mint-bg-transparent data-[engine=postgres]:data-[state=link]:mint-text-[#0b6ec5] dark:data-[engine=postgres]:data-[state=link]:mint-border-[#144eb6] dark:data-[engine=postgres]:data-[state=link]:mint-bg-transparent dark:data-[engine=postgres]:data-[state=link]:mint-text-[#73c7f9] data-[engine=neki]:data-[state=current]:mint-border-[#fbca00] data-[engine=neki]:data-[state=current]:mint-bg-[#fbca00] data-[engine=neki]:data-[state=current]:mint-text-[#1a1a1a] dark:data-[engine=neki]:data-[state=current]:mint-border-[#fbca00] dark:data-[engine=neki]:data-[state=current]:mint-bg-[#fbca00] dark:data-[engine=neki]:data-[state=current]:mint-text-[#1a1a1a] data-[engine=neki]:data-[state=link]:mint-border-[#fbca00] data-[engine=neki]:data-[state=link]:mint-bg-transparent data-[engine=neki]:data-[state=link]:mint-text-[#8f7200] dark:data-[engine=neki]:data-[state=link]:mint-border-[#fbca00] dark:data-[engine=neki]:data-[state=link]:mint-bg-transparent dark:data-[engine=neki]:data-[state=link]:mint-text-[#fbca00] data-[engine=both]:data-[state=current]:mint-border-[#d4d4d4] data-[engine=both]:data-[state=current]:mint-bg-[#f0f0f0] data-[engine=both]:data-[state=current]:mint-text-[#3d3d3d] dark:data-[engine=both]:data-[state=current]:mint-border-[#525252] dark:data-[engine=both]:data-[state=current]:mint-bg-[#2a2a2a] dark:data-[engine=both]:data-[state=current]:mint-text-[#e5e5e5]`,children:label},engine)}return _jsxs(_components.a,{href:__snippet_docsHref_3vlljw(paths[engine]),\"data-engine\":engine,\"data-state\":`link`,title:`View ${__snippet_platformLabels_3vlljw[engine]} documentation`,className:`mint-inline-flex mint-items-center mint-gap-1.5 mint-whitespace-nowrap mint-rounded-full mint-border mint-px-2.5 mint-py-1 mint-text-[13px] mint-font-semibold mint-leading-tight mint-no-underline data-[engine=vitess]:data-[state=current]:mint-border-[#ffc59b] data-[engine=vitess]:data-[state=current]:mint-bg-[#ffe8d8] data-[engine=vitess]:data-[state=current]:mint-text-[#672002] dark:data-[engine=vitess]:data-[state=current]:mint-border-[#962d00] dark:data-[engine=vitess]:data-[state=current]:mint-bg-[#3c1403] dark:data-[engine=vitess]:data-[state=current]:mint-text-[#ffe8d8] data-[engine=vitess]:data-[state=link]:mint-border-[#ffc59b] data-[engine=vitess]:data-[state=link]:mint-bg-transparent data-[engine=vitess]:data-[state=link]:mint-text-[#b83a05] dark:data-[engine=vitess]:data-[state=link]:mint-border-[#962d00] dark:data-[engine=vitess]:data-[state=link]:mint-bg-transparent dark:data-[engine=vitess]:data-[state=link]:mint-text-[#ffc59b] data-[engine=postgres]:data-[state=current]:mint-border-[#a9dffe] data-[engine=postgres]:data-[state=current]:mint-bg-[#ddf2ff] data-[engine=postgres]:data-[state=current]:mint-text-[#0e3682] dark:data-[engine=postgres]:data-[state=current]:mint-border-[#144eb6] dark:data-[engine=postgres]:data-[state=current]:mint-bg-[#08204e] dark:data-[engine=postgres]:data-[state=current]:mint-text-[#ddf2ff] data-[engine=postgres]:data-[state=link]:mint-border-[#a9dffe] data-[engine=postgres]:data-[state=link]:mint-bg-transparent data-[engine=postgres]:data-[state=link]:mint-text-[#0b6ec5] dark:data-[engine=postgres]:data-[state=link]:mint-border-[#144eb6] dark:data-[engine=postgres]:data-[state=link]:mint-bg-transparent dark:data-[engine=postgres]:data-[state=link]:mint-text-[#73c7f9] data-[engine=neki]:data-[state=current]:mint-border-[#fbca00] data-[engine=neki]:data-[state=current]:mint-bg-[#fbca00] data-[engine=neki]:data-[state=current]:mint-text-[#1a1a1a] dark:data-[engine=neki]:data-[state=current]:mint-border-[#fbca00] dark:data-[engine=neki]:data-[state=current]:mint-bg-[#fbca00] dark:data-[engine=neki]:data-[state=current]:mint-text-[#1a1a1a] data-[engine=neki]:data-[state=link]:mint-border-[#fbca00] data-[engine=neki]:data-[state=link]:mint-bg-transparent data-[engine=neki]:data-[state=link]:mint-text-[#8f7200] dark:data-[engine=neki]:data-[state=link]:mint-border-[#fbca00] dark:data-[engine=neki]:data-[state=link]:mint-bg-transparent dark:data-[engine=neki]:data-[state=link]:mint-text-[#fbca00] data-[engine=both]:data-[state=current]:mint-border-[#d4d4d4] data-[engine=both]:data-[state=current]:mint-bg-[#f0f0f0] data-[engine=both]:data-[state=current]:mint-text-[#3d3d3d] dark:data-[engine=both]:data-[state=current]:mint-border-[#525252] dark:data-[engine=both]:data-[state=current]:mint-bg-[#2a2a2a] dark:data-[engine=both]:data-[state=current]:mint-text-[#e5e5e5]`,children:[label,_jsx(`svg`,{\"aria-hidden\":`true`,width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,className:`mint-shrink-0`,children:_jsx(`path`,{d:`M2.5 6h7M6.5 3l3 3-3 3`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})]},engine)})})};const __snippet_PlatformAvailabilityText_3vlljw=({current,vitess,postgres,neki})=>{const _components={a:`a`,..._provideComponents()};return __snippet_combinedPlatformLabels_3vlljw[current]?_jsxs(`p`,{children:[`Available for `,__snippet_combinedPlatformLabels_3vlljw[current],`.`]}):_jsxs(_Fragment,{children:[_jsxs(`p`,{children:[`This page covers `,__snippet_platformLabels_3vlljw[current],`.`]}),vitess\u0026\u0026current!==`vitess`?_jsxs(`p`,{children:[`Vitess version: `,_jsx(_components.a,{href:vitess.startsWith(`/`)?vitess:`/`+vitess,children:__snippet_platformLabels_3vlljw.vitess})]}):null,postgres\u0026\u0026current!==`postgres`?_jsxs(`p`,{children:[`Postgres version: `,_jsx(_components.a,{href:postgres.startsWith(`/`)?postgres:`/`+postgres,children:__snippet_platformLabels_3vlljw.postgres})]}):null,neki\u0026\u0026current!==`neki`?_jsxs(`p`,{children:[`Neki version: `,_jsx(_components.a,{href:neki.startsWith(`/`)?neki:`/`+neki,children:__snippet_platformLabels_3vlljw.neki})]}):null]})};const PlatformAvailability=props=>{const{Visibility}=_provideComponents()||{};if(!Visibility)_missingMdxReference(`Visibility`,true);return _jsxs(_Fragment,{children:[_jsx(Visibility,{for:`humans`,children:_jsx(__snippet_PlatformAvailabilityBadges_3vlljw,{...props})}),_jsx(Visibility,{for:`agents`,children:_jsx(__snippet_PlatformAvailabilityText_3vlljw,{...props})})]})};function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip,Warning,_MdxComponentBoundary}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);if(!_MdxComponentBoundary)_missingMdxReference(`_MdxComponentBoundary`,true);return _jsxs(_Fragment,{children:[_jsx(_MdxComponentBoundary,{name:`PlatformAvailability`,children:_jsx(PlatformAvailability,{current:`vitess`,postgres:`/postgres/scaling/replicas`})}),`\n`,_jsx(Heading,{level:`2`,id:`overview`,children:`Overview`}),`\n`,_jsx(_components.p,{children:`A replica is a continuously updated copy of your Vitess database. Replicas serve two main purposes:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`They provide an additional source for your data to be queried.`}),`\n`,_jsx(_components.li,{children:`They increase database availability by enabling fast failovers for maintenance or unexpected failure.`}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Before utilizing replicas for reducing load on the primary, it’s important to understand the trade-offs. For more information, see the `,_jsx(_components.a,{href:`#data-consistency-and-replication-lag`,children:`Data consistency and replication lag`}),` section.`]})}),`\n`,_jsxs(_components.p,{children:[`For information on replicas running in additional regions, see: `,_jsx(_components.a,{href:`/vitess/scaling/read-only-regions`,children:`Read-only regions`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`how-to-query-replicas`,children:`How to query replicas`}),`\n`,_jsx(_components.p,{children:`PlanetScale replicas can be used to read data and reduce load on the primary. PlanetScale does not automatically route queries to replicas unless you explicitly use a replica credential or tell your application to do so.`}),`\n`,_jsx(Heading,{level:`3`,id:`1-create-a-global-replica-credential-recommended`,children:`1. Create a global replica credential (recommended)`}),`\n`,_jsxs(_components.p,{children:[`With global replica credentials, you can have one credential that will automatically route queries to your branch’s replicas and read-only regions. If you do not have any read-only regions, it will route to the included replicas on `,_jsx(_components.a,{href:`/planetscale-plans`,children:`your plan`}),`. If you do have any read-only regions, the queries will route to the closest replica out of your read-only region replicas and included failover replicas.`]}),`\n`,_jsxs(_components.p,{children:[`To use this, create a new credential in the PlanetScale dashboard and select “`,_jsx(_components.strong,{children:`Replica`}),`” as the connection type. You can then use the new credential’s connection string to setup a replica-only database\nconnection.`]}),`\n`,_jsxs(_components.p,{children:[`If you have `,_jsx(_components.code,{children:`pscale`}),` installed locally, you can create a replica credential with the following command:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pscale`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` password`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` create`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`databas`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`e`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`branc`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`h`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`password_nam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`e`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --replica`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`All queries made using this credential will be routed to the nearest replica, even as you add and remove read-only regions.`}),`\n`,_jsx(_components.p,{children:`To pin traffic to a specific read-only region instead, create a region-scoped password:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`pscale`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` password`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` create`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`databas`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`e`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`branc`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`h`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`password_nam`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`e`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --read-only-region`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`regio`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`n`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/vitess/scaling/read-only-regions#region-scoped-credentials`,children:`Read-only regions`}),` for details.`]}),`\n`,_jsxs(Heading,{level:`3`,id:`2-use-@replica-not-recommended`,children:[`2. `,_jsx(_components.code,{children:`USE @replica`}),` (not recommended)`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`We do not recommend using this method to query replicas. If you are currently using this method, we recommend switching to method 1.`})}),`\n`,_jsxs(_components.p,{children:[`If you are not using a global replica credential, then, by default, all queries are served by the primary. However you may route any `,_jsx(_components.code,{children:`SELECT`}),` queries to replicas by issuing the following command on a connection:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`USE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` @replica`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Once this command is run, all subsequent `,_jsx(_components.code,{children:`SELECT`}),` queries on that connection will be served by your branch’s replicas instead of the primary node in your cluster. Please note that this does not send queries to any read-only regions, if you want to route queries all replicas, including read-only regions, you should use a global replica credential (method 1 above).`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`For querying replicas in separate regions, see: `,_jsx(_components.a,{href:`/vitess/scaling/read-only-regions`,children:`Read-only regions`}),`.`]})}),`\n`,_jsx(_components.p,{children:`We highly recommend using a global replica credential to ensure that your queries are always routed to the nearest replica.`}),`\n`,_jsx(Heading,{level:`2`,id:`high-availability`,children:`High availability`}),`\n`,_jsxs(_components.p,{children:[`Replicas within PlanetScale are used to enable high availability of your database. This is a part of the reason all production branches in PlanetScale are provided at least one replica. In situations where the underlying hardware or service hosting the primary MySQL node fails, our system will automatically elect a new primary node from the available replicas and reroute traffic to that new primary. This process is know as `,_jsx(_components.strong,{children:`reparenting`}),` and typically is all handled within milliseconds or seconds.`]}),`\n`,_jsxs(_components.p,{children:[`Querying the primary during a reparent typically goes unnoticed, other than a bit of additional query latency.\nThis is because Vitess `,_jsx(_components.a,{href:`https://vitess.io/docs/reference/features/vtgate-buffering`,children:`buffers queries`}),` during this time.\nYou can incorporate retry logic into your application to handle the rare instances where an issue arises during reparenting.`]}),`\n`,_jsx(_components.p,{children:`When querying a replica during a reparent, you may encounter this error:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`no healthy tablet available for 'keyspace:\"\\${keyspace}\" shard:\"\\${shard}\" tablet_type:REPLICA'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`Incorporating retry logic into your application can help with this scenario as well.`}),`\n`,_jsx(Heading,{level:`2`,id:`multiple-availability-zones`,children:`Multiple availability zones`}),`\n`,_jsxs(_components.p,{children:[`In cloud architecture, regions are further broken down into data centers known as availability zones (or AZs for short). For example, the `,_jsx(_components.code,{children:`us-east-1`}),` region on AWS contains 6 default AZs available to customers starting with `,_jsx(_components.code,{children:`us-east-1a`}),` through `,_jsx(_components.code,{children:`us-east-1f`}),`. The infrastructure for all Base plan and Enterprise PlanetScale databases are distributed across 3 availability zones. In the instance of an AZ failure, your database will auto failover to an available AZ.`]}),`\n`,_jsx(Heading,{level:`2`,id:`data-consistency-and-replication-lag`,children:`Data consistency and replication lag`}),`\n`,_jsxs(_components.p,{children:[`Whenever data is updated (`,_jsx(_components.code,{children:`INSERT`}),`, `,_jsx(_components.code,{children:`UPDATE`}),`, `,_jsx(_components.code,{children:`DELETE`}),`) on the primary node, those changes are synchronized to the replicas shortly after. The delay between when a primary is updated and the changes are applied to the replica is known as `,_jsx(_components.code,{children:`replication lag`}),`. Your databases replication lag is viewable on your `,_jsx(_components.a,{href:`/vitess/architecture#replication-lag-at-a-glance`,children:`database dashboard`}),`. Replication lag can also be viewed on Datadog if you set up the `,_jsx(_components.a,{href:`/vitess/integrations/datadog`,children:`PlanetScale - Datadog integration`}),`.`]}),`\n`,_jsx(_components.p,{children:`In Datadog, you can use the following formula to set alerts for replication lag:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`(max:planetscale.replication_lag{ps_database:\u003cDATABASE_NAME> ps_tablet_type:replica, ps_branch:\u003cMAIN>})`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Make sure you replace `,_jsx(_components.code,{children:`\u003cDATABASE_NAME>`}),` with your PlanetScale database name and `,_jsx(_components.code,{children:`\u003cMAIN>`}),` with the name of the branch for which you’d like to track replication lag.`]}),`\n`,_jsx(_components.p,{children:`It is important to be aware of replication lag whenever querying data from your replicas. For example, if you make an update and then immediately try to query for that updated data via a replica, it may not be available yet due to replication lag.`}),`\n`,_jsx(Heading,{level:`2`,id:`when-should-you-use-replicas-in-your-application`,children:`When should you use replicas in your application?`}),`\n`,_jsx(_components.p,{children:`Replicas are useful for offloading read-heavy workloads from the primary node. By using replicas, you can distribute the read load across multiple nodes, which can help improve the performance of your application. Some examples of where you might want to query a replica are scheduled jobs, analytics jobs, search features, or aggregate queries. Replicas can also be used to provide a read-only view of your data to users or applications that do not need to write data, such as when a user is logged out or writing one-off queries for debugging purposes.`}),`\n`,_jsx(Heading,{level:`2`,id:`when-are-replicas-used-in-planetscale`,children:`When are replicas used in PlanetScale?`}),`\n`,_jsx(_components.p,{children:`We use replicas for every production database branch. The number of replicas for a given database depends on the selected plan for that database:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Base plan`}),` — Base plan databases include 2 replicas per production branch distributed across multiple AZs in a given region.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Enterprise`}),` — The Enterprise plan is customizable to fit the needs of your organization, and as such can have as many replicas as needed.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`/vitess/scaling/read-only-regions`,children:`Read-only regions`}),` also run replicas, hosted in a different geographical region. Each read-only region has its own cluster size and replica count, configured per keyspace independently of the primary region. It is important to note that the MySQL nodes in read-only regions are replicas intended only for reading data and are not eligible for failover if the primary node experiences an outage.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Development branches DO NOT have replicas as they are intended for development only and are not designed with the same resiliency as production branches.`})}),`\n`,_jsx(Heading,{level:`2`,id:`need-help`,children:`Need help?`}),`\n`,_jsxs(_components.p,{children:[`Get help from `,_jsx(_components.a,{href:`https://planetscale.com/contact?initial=support`,children:`the PlanetScale Support team`}),`, or join our\\xA0`,_jsx(_components.a,{href:`https://pscale.link/community`,children:`Discord community`}),` to see how others are using PlanetScale.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{__snippet_platformLabels_3vlljw,__snippet_combinedPlatformLabels_3vlljw,__snippet_platformBadgeClassName_3vlljw,__snippet_docsHref_3vlljw,__snippet_PlatformAvailabilityBadges_3vlljw,__snippet_PlatformAvailabilityText_3vlljw,PlatformAvailability,default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Database replicas","sidebarTitle":"Replicas","og:image":"images/og/vitess/scaling/replicas.png","description":null,"href":"/vitess/scaling/replicas"}}},"mdxSourceWithNoJs":null,"noJsSplices":[[166,14628,"undefined;const __snippet_combinedPlatformLabels_3vlljw=undefined;const __snippet_platformBadgeClassName_3vlljw=undefined;const __snippet_docsHref_3vlljw=()=>null;const __snippet_PlatformAvailabilityBadges_3vlljw=()=>null;const __snippet_PlatformAvailabilityText_3vlljw=()=>null;const PlatformAvailability=()=>null;funct"]]},"mdxExtracts":{"tableOfContents":[{"title":"Overview","slug":"overview","depth":2,"children":[]},{"title":"How to query replicas","slug":"how-to-query-replicas","depth":2,"children":[{"title":"1. Create a global replica credential (recommended)","slug":"1-create-a-global-replica-credential-recommended","depth":3,"children":[]},{"title":"2. USE @replica (not recommended)","slug":"2-use-@replica-not-recommended","depth":3,"children":[]}]},{"title":"High availability","slug":"high-availability","depth":2,"children":[]},{"title":"Multiple availability zones","slug":"multiple-availability-zones","depth":2,"children":[]},{"title":"Data consistency and replication lag","slug":"data-consistency-and-replication-lag","depth":2,"children":[]},{"title":"When should you use replicas in your application?","slug":"when-should-you-use-replicas-in-your-application","depth":2,"children":[]},{"title":"When are replicas used in PlanetScale?","slug":"when-are-replicas-used-in-planetscale","depth":2,"children":[]},{"title":"Need help?","slug":"need-help","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/docs/_mintlify/custom/planetscale-2/b155242ec3c4945e/custom.js"],"dynamicCss":".mint-mb-5 {\n margin-bottom: 1.25rem\n}\n.mint-flex {\n display: flex\n}\n.mint-inline-flex {\n display: inline-flex\n}\n.mint-shrink-0 {\n flex-shrink: 0\n}\n.mint-flex-wrap {\n flex-wrap: wrap\n}\n.mint-items-center {\n align-items: center\n}\n.mint-gap-1\\.5 {\n gap: 0.375rem\n}\n.mint-gap-2 {\n gap: 0.5rem\n}\n.mint-whitespace-nowrap {\n white-space: nowrap\n}\n.mint-rounded-full {\n border-radius: 9999px\n}\n.mint-border {\n border-width: 1px\n}\n.mint-px-2\\.5 {\n padding-left: 0.625rem;\n padding-right: 0.625rem\n}\n.mint-py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem\n}\n.mint-text-\\[13px\\] {\n font-size: 13px\n}\n.mint-font-semibold {\n font-weight: 600\n}\n.mint-leading-tight {\n line-height: 1.25\n}\n.mint-no-underline {\n text-decoration-line: none\n}\n.data-\\[engine\\=both\\]\\:data-\\[state\\=current\\]\\:mint-border-\\[\\#d4d4d4\\][data-state=\"current\"][data-engine=\"both\"] {\n --tw-border-opacity: 1;\n border-color: rgb(212 212 212 / var(--tw-border-opacity, 1))\n}\n.data-\\[engine\\=neki\\]\\:data-\\[state\\=current\\]\\:mint-border-\\[\\#fbca00\\][data-state=\"current\"][data-engine=\"neki\"] {\n --tw-border-opacity: 1;\n border-color: rgb(251 202 0 / var(--tw-border-opacity, 1))\n}\n.data-\\[engine\\=neki\\]\\:data-\\[state\\=link\\]\\:mint-border-\\[\\#fbca00\\][data-state=\"link\"][data-engine=\"neki\"] {\n --tw-border-opacity: 1;\n border-color: rgb(251 202 0 / var(--tw-border-opacity, 1))\n}\n.data-\\[engine\\=postgres\\]\\:data-\\[state\\=current\\]\\:mint-border-\\[\\#a9dffe\\][data-state=\"current\"][data-engine=\"postgres\"] {\n --tw-border-opacity: 1;\n border-color: rgb(169 223 254 / var(--tw-border-opacity, 1))\n}\n.data-\\[engine\\=postgres\\]\\:data-\\[state\\=link\\]\\:mint-border-\\[\\#a9dffe\\][data-state=\"link\"][data-engine=\"postgres\"] {\n --tw-border-opacity: 1;\n border-color: rgb(169 223 254 / var(--tw-border-opacity, 1))\n}\n.data-\\[engine\\=vitess\\]\\:data-\\[state\\=current\\]\\:mint-border-\\[\\#ffc59b\\][data-state=\"current\"][data-engine=\"vitess\"] {\n --tw-border-opacity: 1;\n border-color: rgb(255 197 155 / var(--tw-border-opacity, 1))\n}\n.data-\\[engine\\=vitess\\]\\:data-\\[state\\=link\\]\\:mint-border-\\[\\#ffc59b\\][data-state=\"link\"][data-engine=\"vitess\"] {\n --tw-border-opacity: 1;\n border-color: rgb(255 197 155 / var(--tw-border-opacity, 1))\n}\n.data-\\[engine\\=both\\]\\:data-\\[state\\=current\\]\\:mint-bg-\\[\\#f0f0f0\\][data-state=\"current\"][data-engine=\"both\"] {\n --tw-bg-opacity: 1;\n background-color: rgb(240 240 240 / var(--tw-bg-opacity, 1))\n}\n.data-\\[engine\\=neki\\]\\:data-\\[state\\=current\\]\\:mint-bg-\\[\\#fbca00\\][data-state=\"current\"][data-engine=\"neki\"] {\n --tw-bg-opacity: 1;\n background-color: rgb(251 202 0 / var(--tw-bg-opacity, 1))\n}\n.data-\\[engine\\=neki\\]\\:data-\\[state\\=link\\]\\:mint-bg-transparent[data-state=\"link\"][data-engine=\"neki\"] {\n background-color: transparent\n}\n.data-\\[engine\\=postgres\\]\\:data-\\[state\\=current\\]\\:mint-bg-\\[\\#ddf2ff\\][data-state=\"current\"][data-engine=\"postgres\"] {\n --tw-bg-opacity: 1;\n background-color: rgb(221 242 255 / var(--tw-bg-opacity, 1))\n}\n.data-\\[engine\\=postgres\\]\\:data-\\[state\\=link\\]\\:mint-bg-transparent[data-state=\"link\"][data-engine=\"postgres\"] {\n background-color: transparent\n}\n.data-\\[engine\\=vitess\\]\\:data-\\[state\\=current\\]\\:mint-bg-\\[\\#ffe8d8\\][data-state=\"current\"][data-engine=\"vitess\"] {\n --tw-bg-opacity: 1;\n background-color: rgb(255 232 216 / var(--tw-bg-opacity, 1))\n}\n.data-\\[engine\\=vitess\\]\\:data-\\[state\\=link\\]\\:mint-bg-transparent[data-state=\"link\"][data-engine=\"vitess\"] {\n background-color: transparent\n}\n.data-\\[engine\\=both\\]\\:data-\\[state\\=current\\]\\:mint-text-\\[\\#3d3d3d\\][data-state=\"current\"][data-engine=\"both\"] {\n --tw-text-opacity: 1;\n color: rgb(61 61 61 / var(--tw-text-opacity, 1))\n}\n.data-\\[engine\\=neki\\]\\:data-\\[state\\=current\\]\\:mint-text-\\[\\#1a1a1a\\][data-state=\"current\"][data-engine=\"neki\"] {\n --tw-text-opacity: 1;\n color: rgb(26 26 26 / var(--tw-text-opacity, 1))\n}\n.data-\\[engine\\=neki\\]\\:data-\\[state\\=link\\]\\:mint-text-\\[\\#8f7200\\][data-state=\"link\"][data-engine=\"neki\"] {\n --tw-text-opacity: 1;\n color: rgb(143 114 0 / var(--tw-text-opacity, 1))\n}\n.data-\\[engine\\=postgres\\]\\:data-\\[state\\=current\\]\\:mint-text-\\[\\#0e3682\\][data-state=\"current\"][data-engine=\"postgres\"] {\n --tw-text-opacity: 1;\n color: rgb(14 54 130 / var(--tw-text-opacity, 1))\n}\n.data-\\[engine\\=postgres\\]\\:data-\\[state\\=link\\]\\:mint-text-\\[\\#0b6ec5\\][data-state=\"link\"][data-engine=\"postgres\"] {\n --tw-text-opacity: 1;\n color: rgb(11 110 197 / var(--tw-text-opacity, 1))\n}\n.data-\\[engine\\=vitess\\]\\:data-\\[state\\=current\\]\\:mint-text-\\[\\#672002\\][data-state=\"current\"][data-engine=\"vitess\"] {\n --tw-text-opacity: 1;\n color: rgb(103 32 2 / var(--tw-text-opacity, 1))\n}\n.data-\\[engine\\=vitess\\]\\:data-\\[state\\=link\\]\\:mint-text-\\[\\#b83a05\\][data-state=\"link\"][data-engine=\"vitess\"] {\n --tw-text-opacity: 1;\n color: rgb(184 58 5 / var(--tw-text-opacity, 1))\n}\n.dark\\:data-\\[engine\\=both\\]\\:data-\\[state\\=current\\]\\:mint-border-\\[\\#525252\\][data-state=\"current\"][data-engine=\"both\"]:is(.dark *) {\n --tw-border-opacity: 1;\n border-color: rgb(82 82 82 / var(--tw-border-opacity, 1))\n}\n.dark\\:data-\\[engine\\=neki\\]\\:data-\\[state\\=current\\]\\:mint-border-\\[\\#fbca00\\][data-state=\"current\"][data-engine=\"neki\"]:is(.dark *) {\n --tw-border-opacity: 1;\n border-color: rgb(251 202 0 / var(--tw-border-opacity, 1))\n}\n.dark\\:data-\\[engine\\=neki\\]\\:data-\\[state\\=link\\]\\:mint-border-\\[\\#fbca00\\][data-state=\"link\"][data-engine=\"neki\"]:is(.dark *) {\n --tw-border-opacity: 1;\n border-color: rgb(251 202 0 / var(--tw-border-opacity, 1))\n}\n.dark\\:data-\\[engine\\=postgres\\]\\:data-\\[state\\=current\\]\\:mint-border-\\[\\#144eb6\\][data-state=\"current\"][data-engine=\"postgres\"]:is(.dark *) {\n --tw-border-opacity: 1;\n border-color: rgb(20 78 182 / var(--tw-border-opacity, 1))\n}\n.dark\\:data-\\[engine\\=postgres\\]\\:data-\\[state\\=link\\]\\:mint-border-\\[\\#144eb6\\][data-state=\"link\"][data-engine=\"postgres\"]:is(.dark *) {\n --tw-border-opacity: 1;\n border-color: rgb(20 78 182 / var(--tw-border-opacity, 1))\n}\n.dark\\:data-\\[engine\\=vitess\\]\\:data-\\[state\\=current\\]\\:mint-border-\\[\\#962d00\\][data-state=\"current\"][data-engine=\"vitess\"]:is(.dark *) {\n --tw-border-opacity: 1;\n border-color: rgb(150 45 0 / var(--tw-border-opacity, 1))\n}\n.dark\\:data-\\[engine\\=vitess\\]\\:data-\\[state\\=link\\]\\:mint-border-\\[\\#962d00\\][data-state=\"link\"][data-engine=\"vitess\"]:is(.dark *) {\n --tw-border-opacity: 1;\n border-color: rgb(150 45 0 / var(--tw-border-opacity, 1))\n}\n.dark\\:data-\\[engine\\=both\\]\\:data-\\[state\\=current\\]\\:mint-bg-\\[\\#2a2a2a\\][data-state=\"current\"][data-engine=\"both\"]:is(.dark *) {\n --tw-bg-opacity: 1;\n background-color: rgb(42 42 42 / var(--tw-bg-opacity, 1))\n}\n.dark\\:data-\\[engine\\=neki\\]\\:data-\\[state\\=current\\]\\:mint-bg-\\[\\#fbca00\\][data-state=\"current\"][data-engine=\"neki\"]:is(.dark *) {\n --tw-bg-opacity: 1;\n background-color: rgb(251 202 0 / var(--tw-bg-opacity, 1))\n}\n.dark\\:data-\\[engine\\=neki\\]\\:data-\\[state\\=link\\]\\:mint-bg-transparent[data-state=\"link\"][data-engine=\"neki\"]:is(.dark *) {\n background-color: transparent\n}\n.dark\\:data-\\[engine\\=postgres\\]\\:data-\\[state\\=current\\]\\:mint-bg-\\[\\#08204e\\][data-state=\"current\"][data-engine=\"postgres\"]:is(.dark *) {\n --tw-bg-opacity: 1;\n background-color: rgb(8 32 78 / var(--tw-bg-opacity, 1))\n}\n.dark\\:data-\\[engine\\=postgres\\]\\:data-\\[state\\=link\\]\\:mint-bg-transparent[data-state=\"link\"][data-engine=\"postgres\"]:is(.dark *) {\n background-color: transparent\n}\n.dark\\:data-\\[engine\\=vitess\\]\\:data-\\[state\\=current\\]\\:mint-bg-\\[\\#3c1403\\][data-state=\"current\"][data-engine=\"vitess\"]:is(.dark *) {\n --tw-bg-opacity: 1;\n background-color: rgb(60 20 3 / var(--tw-bg-opacity, 1))\n}\n.dark\\:data-\\[engine\\=vitess\\]\\:data-\\[state\\=link\\]\\:mint-bg-transparent[data-state=\"link\"][data-engine=\"vitess\"]:is(.dark *) {\n background-color: transparent\n}\n.dark\\:data-\\[engine\\=both\\]\\:data-\\[state\\=current\\]\\:mint-text-\\[\\#e5e5e5\\][data-state=\"current\"][data-engine=\"both\"]:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(229 229 229 / var(--tw-text-opacity, 1))\n}\n.dark\\:data-\\[engine\\=neki\\]\\:data-\\[state\\=current\\]\\:mint-text-\\[\\#1a1a1a\\][data-state=\"current\"][data-engine=\"neki\"]:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(26 26 26 / var(--tw-text-opacity, 1))\n}\n.dark\\:data-\\[engine\\=neki\\]\\:data-\\[state\\=link\\]\\:mint-text-\\[\\#fbca00\\][data-state=\"link\"][data-engine=\"neki\"]:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(251 202 0 / var(--tw-text-opacity, 1))\n}\n.dark\\:data-\\[engine\\=postgres\\]\\:data-\\[state\\=current\\]\\:mint-text-\\[\\#ddf2ff\\][data-state=\"current\"][data-engine=\"postgres\"]:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(221 242 255 / var(--tw-text-opacity, 1))\n}\n.dark\\:data-\\[engine\\=postgres\\]\\:data-\\[state\\=link\\]\\:mint-text-\\[\\#73c7f9\\][data-state=\"link\"][data-engine=\"postgres\"]:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(115 199 249 / var(--tw-text-opacity, 1))\n}\n.dark\\:data-\\[engine\\=vitess\\]\\:data-\\[state\\=current\\]\\:mint-text-\\[\\#ffe8d8\\][data-state=\"current\"][data-engine=\"vitess\"]:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(255 232 216 / var(--tw-text-opacity, 1))\n}\n.dark\\:data-\\[engine\\=vitess\\]\\:data-\\[state\\=link\\]\\:mint-text-\\[\\#ffc59b\\][data-state=\"link\"][data-engine=\"vitess\"]:is(.dark *) {\n --tw-text-opacity: 1;\n color: rgb(255 197 155 / var(--tw-text-opacity, 1))\n}","subdomain":"planetscale-2","siteName":"PlanetScale","title":"Database replicas - PlanetScale","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-30T17:09:43.026Z","originalFileLocation":"vitess/scaling/replicas.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"PlanetScale\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Database replicas - PlanetScale\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"PlanetScale\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://planetscale.com/docs/vitess/scaling/replicas\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://planetscale-2.mintlify.app/images/og/vitess/scaling/replicas.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Database replicas - PlanetScale\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://planetscale-2.mintlify.app/images/og/vitess/scaling/replicas.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/planetscale-2/_bFyi8IG4CeLblEd/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"PlanetScale\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0e73cc\">\u003clink data-mint-head rel=\"canonical\" href=\"https://planetscale.com/docs/vitess/scaling/replicas\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/vitess/scaling/replicas.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://planetscale.com/#organization\",\"name\":\"PlanetScale\",\"url\":\"https://planetscale.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/planetscale-2/xUilVHToUFALai8a/logo/light.png?fit=max\u0026auto=format\u0026n=xUilVHToUFALai8a\u0026q=85\u0026s=cccd3c9fc813c01b899ab7af15a115b1\"}},{\"@type\":\"WebSite\",\"@id\":\"https://planetscale.com/docs#website\",\"name\":\"PlanetScale\",\"url\":\"https://planetscale.com/docs\",\"publisher\":{\"@id\":\"https://planetscale.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://planetscale.com/docs/vitess/scaling/replicas#webpage\",\"url\":\"https://planetscale.com/docs/vitess/scaling/replicas\",\"name\":\"Database replicas\",\"dateModified\":\"2026-10-30T17:09:43.026Z\",\"isPartOf\":{\"@id\":\"https://planetscale.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://planetscale.com/docs/vitess/scaling/replicas#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://planetscale.com/docs/vitess/scaling/replicas#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Platform\",\"item\":\"https://planetscale.com/docs/vitess/architecture\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scaling\",\"item\":\"https://planetscale.com/docs/vitess/scaling/cluster-sizing\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Database replicas\",\"item\":\"https://planetscale.com/docs/vitess/scaling/replicas\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://planetscale.com/docs/vitess/scaling/replicas#article\",\"headline\":\"Database replicas\",\"name\":\"Database replicas\",\"url\":\"https://planetscale.com/docs/vitess/scaling/replicas\",\"mainEntityOfPage\":{\"@id\":\"https://planetscale.com/docs/vitess/scaling/replicas#webpage\"},\"image\":\"https://planetscale.com/docs/images/og/vitess/scaling/replicas.png\",\"dateModified\":\"2026-10-30T17:09:43.026Z\",\"publisher\":{\"@id\":\"https://planetscale.com/#organization\"},\"isPartOf\":{\"@id\":\"https://planetscale.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"PlanetScale\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"PlanetScale","nav":{"global":{"anchors":[{"anchor":"Blog","icon":"newspaper","href":"https://planetscale.com/blog"},{"anchor":"Contact Us","icon":"headset","href":"https://planetscale.com/contact"},{"anchor":"Status","icon":"signal","href":"https://www.planetscalestatus.com/"},{"anchor":"Benchmarks","icon":"chart-line","href":"https://planetscale.com/benchmarks"}]},"tabs":[{"tab":"Platform","pages":[{"title":"Platform","href":""}]},{"tab":"Vitess","groups":[{"group":" ","pages":[{"title":"PlanetScale for Vitess","sidebarTitle":"Vitess","href":"/vitess"}]},{"group":"Pricing","pages":[{"title":"Pricing","href":"/vitess/pricing"}]},{"group":"Platform","pages":[{"group":"Getting Started","pages":[{"title":"PlanetScale Vitess architecture","sidebarTitle":"Vitess architecture","href":"/vitess/architecture"},{"title":"PlanetScale workflow for Vitess","sidebarTitle":"Vitess workflow","href":"/vitess/best-practices"},{"title":"PlanetScale Vitess quickstart guide","sidebarTitle":"Step-by-step guide","href":"/vitess/tutorials/planetscale-quick-start-guide"},{"title":"Cluster sizing","sidebarTitle":"Cluster sizing","href":"/plans/cluster-sizing"},{"title":"Cluster configuration","href":"/vitess/cluster-configuration"},{"title":"Disk autoscaling","href":"/vitess/cluster-configuration/disk-autoscaling"},{"title":"Cluster configuration parameters","sidebarTitle":"Parameters","href":"/vitess/cluster-configuration/parameters"},{"title":"Per-shard sizing","href":"/vitess/cluster-configuration/per-shard-sizing"},{"title":"Database replicas","sidebarTitle":"Replicas","href":"/vitess/replicas"},{"title":"Foreign key constraints","sidebarTitle":"Foreign key constraints support","href":"/vitess/foreign-key-constraints"},{"title":"Web console","sidebarTitle":"Web console","href":"/vitess/web-console"},{"title":"PlanetScale terminology","sidebarTitle":"Terminology","href":"/vitess/terminology"},{"title":"MySQL compatibility","sidebarTitle":"MySQL compatibility","href":"/vitess/mysql-compatibility"}]},{"group":"Imports","pages":[{"title":"Discovery Tool","sidebarTitle":"Discovery tool","href":"/vitess/imports/discovery-tool"},{"title":"What are workflows?","sidebarTitle":"Workflows","href":"/vitess/scaling/workflows"},{"group":"Database imports","pages":[{"title":"Database imports","href":"/vitess/imports/database-imports"},{"title":"Import public IP addresses","href":"/vitess/imports/import-tool-migration-addresses"},{"title":"Import user permissions","href":"/vitess/imports/import-tool-user-requirements"},{"title":"Import troubleshooting","href":"/vitess/imports/import-troubleshooting"}]},{"group":"MySQL to PlanetScale Vitess migration","pages":[{"title":"Amazon Aurora migration guide","sidebarTitle":"Amazon Aurora","href":"/vitess/imports/amazon-aurora-migration-guide"},{"title":"AWS RDS migration guide","sidebarTitle":"Amazon RDS","href":"/vitess/imports/aws-rds-migration-guide"},{"title":"Azure Database for MySQL migration guide","sidebarTitle":"Azure","href":"/vitess/imports/azure-database-for-mysql-migration-guide"},{"title":"DigitalOcean database migration guide","sidebarTitle":"DigitalOcean","href":"/vitess/imports/digitalocean-database-migration-guide"},{"title":"GCP Cloud SQL Migration Guide","sidebarTitle":"GCP Cloud SQL","href":"/vitess/imports/gcp-cloudsql-migration-guide"},{"title":"MariaDB migration guide","sidebarTitle":"MariaDB","href":"/vitess/imports/mariadb-migration-guide"}]},{"group":"Postgres to PlanetScale Vitess migration","pages":[{"title":"Postgres to Vitess imports","sidebarTitle":"Postgres to Vitess overview","href":"/vitess/imports/postgres"},{"title":"Postgres to PlanetScale for Vitess migration guide","sidebarTitle":"Postgres to Vitess directly","href":"/vitess/imports/postgres-planetscale-migration-guide"},{"title":"Postgres to MySQL to PlanetScale migration guide","sidebarTitle":"Postgres to Vitess with intermediate MySQL","href":"/vitess/imports/postgres-mysql-planetscale-migration-guide"}]}]},{"group":"Connecting","pages":[{"title":"Connect any application to PlanetScale","sidebarTitle":"Connect any app","href":"/vitess/tutorials/connect-any-application"},{"title":"Connect a MySQL GUI to PlanetScale","sidebarTitle":"Connect a MySQL GUI","href":"/vitess/tutorials/connect-mysql-gui"},{"title":"Connection strings","href":"/vitess/connecting/connection-strings"},{"title":"Network latency","href":"/vitess/connecting/network-latency"},{"group":"MCP","pages":[{"title":"PlanetScale Model Context Protocol (MCP)","sidebarTitle":"Overview","href":"/mcp-server"},{"title":"Authenticate the MCP server with a service token","sidebarTitle":"Service tokens","href":"/mcp/service-token"}]},{"title":"Self-improving database","sidebarTitle":"Self-improving database","href":"/self-improving-database"},{"title":"PlanetScale Terraform provider","sidebarTitle":"Terraform provider","href":"/terraform"},{"group":"Private connections","pages":[{"title":"Connecting to PlanetScale privately on AWS","sidebarTitle":"AWS PrivateLink","href":"/vitess/connecting/private-connections"},{"title":"Connecting to PlanetScale privately on GCP","sidebarTitle":"GCP Private Service Connect","href":"/vitess/connecting/private-connections-gcp"}]}]},{"group":"Schema changes","pages":[{"title":"Non-blocking schema changes","href":"/vitess/schema-changes"},{"title":"Safe migrations","href":"/vitess/schema-changes/safe-migrations"},{"group":"Branching","pages":[{"title":"Branching","sidebarTitle":"Using branches","href":"/vitess/schema-changes/branching"},{"title":"Data Branching®","href":"/vitess/schema-changes/data-branching"}]},{"group":"Deploy requests","pages":[{"title":"Deploy requests","sidebarTitle":"Using deploy requests","href":"/vitess/schema-changes/deploy-requests"},{"title":"Throttling deploy requests","href":"/vitess/schema-changes/throttling-deploy-requests"},{"title":"Aggressive deploy request cutover","sidebarTitle":"Aggressive cutover","href":"/vitess/schema-changes/aggressive-cutover"},{"title":"Long-running transactions","sidebarTitle":"Long-running transactions","href":"/vitess/schema-changes/long-running-transactions"},{"title":"Column cannot be null","sidebarTitle":"Column cannot be null","href":"/vitess/schema-changes/column-cannot-be-null"},{"title":"Column has no default value","sidebarTitle":"Column has no default value","href":"/vitess/schema-changes/column-has-no-default"},{"title":"Duplicate entry for unique key","sidebarTitle":"Duplicate entry","href":"/vitess/schema-changes/duplicate-entry"},{"title":"Value does not fit the new column","sidebarTitle":"Value does not fit column","href":"/vitess/schema-changes/value-does-not-fit-column"},{"title":"Constraint not found","sidebarTitle":"Constraint not found","href":"/vitess/schema-changes/constraint-not-found"},{"title":"Foreign key missing unique key","sidebarTitle":"Foreign key missing unique key","href":"/vitess/schema-changes/foreign-key-missing-unique-key"},{"title":"Earlier migration failed","sidebarTitle":"Earlier migration failed","href":"/vitess/schema-changes/earlier-migration-failed"}]},{"group":"Schema lint errors","pages":[{"title":"Schema lint errors","sidebarTitle":"Schema lint errors","href":"/vitess/schema-changes/schema-lint-errors"},{"title":"UNSPECIFIED schema lint error","sidebarTitle":"UNSPECIFIED","href":"/vitess/schema-changes/schema-lint-errors/unspecified"},{"title":"NO_UNIQUE_KEY schema lint error","sidebarTitle":"NO_UNIQUE_KEY","href":"/vitess/schema-changes/schema-lint-errors/no-unique-key"},{"title":"FOREIGN_KEYS_DISALLOWED schema lint error","sidebarTitle":"FOREIGN_KEYS_DISALLOWED","href":"/vitess/schema-changes/schema-lint-errors/foreign-keys-disallowed"},{"title":"INVALID_CHARSET schema lint error","sidebarTitle":"INVALID_CHARSET","href":"/vitess/schema-changes/schema-lint-errors/invalid-charset"},{"title":"UNSUPPORTED_FEATURE schema lint error","sidebarTitle":"UNSUPPORTED_FEATURE","href":"/vitess/schema-changes/schema-lint-errors/unsupported-feature"},{"title":"UNSUPPORTED_SHARDED_FEATURE schema lint error","sidebarTitle":"UNSUPPORTED_SHARDED_FEATURE","href":"/vitess/schema-changes/schema-lint-errors/unsupported-sharded-feature"},{"title":"INVALID_VSCHEMA schema lint error","sidebarTitle":"INVALID_VSCHEMA","href":"/vitess/schema-changes/schema-lint-errors/invalid-vschema"},{"title":"DUPLICATE_ENUM_VALUE schema lint error","sidebarTitle":"DUPLICATE_ENUM_VALUE","href":"/vitess/schema-changes/schema-lint-errors/duplicate-enum-value"},{"title":"UNSUPPORTED_PARTITIONING_FEATURE schema lint error","sidebarTitle":"UNSUPPORTED_PARTITIONING_FEATURE","href":"/vitess/schema-changes/schema-lint-errors/unsupported-partitioning-feature"},{"title":"INVALID_TABLE_REFERENCED_IN_VIEW schema lint error","sidebarTitle":"INVALID_TABLE_REFERENCED_IN_VIEW","href":"/vitess/schema-changes/schema-lint-errors/invalid-table-referenced-in-view"},{"title":"INVALID_COLUMN_REFERENCED_IN_VIEW schema lint error","sidebarTitle":"INVALID_COLUMN_REFERENCED_IN_VIEW","href":"/vitess/schema-changes/schema-lint-errors/invalid-column-referenced-in-view"},{"title":"BLOB_IN_UNIQUE_KEY schema lint error","sidebarTitle":"BLOB_IN_UNIQUE_KEY","href":"/vitess/schema-changes/schema-lint-errors/blob-in-unique-key"},{"title":"PARTIAL_KEY_IN_UNIQUE_KEY schema lint error","sidebarTitle":"PARTIAL_KEY_IN_UNIQUE_KEY","href":"/vitess/schema-changes/schema-lint-errors/partial-key-in-unique-key"},{"title":"FOREIGN_KEYS_CIRCULAR_DEPENDENCY schema lint error","sidebarTitle":"FOREIGN_KEYS_CIRCULAR_DEPENDENCY","href":"/vitess/schema-changes/schema-lint-errors/foreign-keys-circular-dependency"},{"title":"FOREIGN_KEYS_NONEXISTENT_TABLE schema lint error","sidebarTitle":"FOREIGN_KEYS_NONEXISTENT_TABLE","href":"/vitess/schema-changes/schema-lint-errors/foreign-keys-nonexistent-table"},{"title":"FOREIGN_KEYS_REFERENCED_VIEW schema lint error","sidebarTitle":"FOREIGN_KEYS_REFERENCED_VIEW","href":"/vitess/schema-changes/schema-lint-errors/foreign-keys-referenced-view"},{"title":"FOREIGN_KEYS_UNRESOLVED schema lint error","sidebarTitle":"FOREIGN_KEYS_UNRESOLVED","href":"/vitess/schema-changes/schema-lint-errors/foreign-keys-unresolved"},{"title":"INVALID_ROUTING_RULES schema lint error","sidebarTitle":"INVALID_ROUTING_RULES","href":"/vitess/schema-changes/schema-lint-errors/invalid-routing-rules"}]},{"group":"Schema changes","pages":[{"title":"How to make different types of schema changes","href":"/vitess/schema-changes/how-to-make-different-types-of-schema-changes"},{"title":"PlanetScale GitHub Actions","sidebarTitle":"Automating with GitHub Actions","href":"/vitess/integrations/github-actions"},{"title":"Handling table and column renames","href":"/vitess/schema-changes/handling-table-and-column-renames"},{"title":"Online DDL change unique keys","sidebarTitle":"Changing primary and unique keys","href":"/vitess/schema-changes/onlineddl-change-unique-keys"}]}]},{"group":"Monitoring","pages":[{"group":"PlanetScale Insights","pages":[{"title":"Query Insights","href":"/vitess/monitoring/query-insights"},{"title":"Inspect live Vitess connections","sidebarTitle":"Connections","href":"/vitess/monitoring/connections"},{"title":"Tags","href":"/vitess/monitoring/query-tags"},{"title":"Anomalies","sidebarTitle":"Anomalies","href":"/vitess/monitoring/anomalies"},{"title":"Errors","sidebarTitle":"Errors","href":"/vitess/monitoring/errors"},{"title":"Schema recommendations","sidebarTitle":"Schema recommendations","href":"/vitess/monitoring/schema-recommendations"}]},{"group":"Prometheus","pages":[{"title":"Prometheus","sidebarTitle":"Connecting Prometheus","href":"/vitess/integrations/prometheus"},{"title":"Grafana Dashboard for PlanetScale Branches","sidebarTitle":"Visualizing in Grafana","href":"/vitess/tutorials/prometheus-metrics-grafana"},{"title":"Sending Prometheus Metrics to Datadog","sidebarTitle":"Collecting in the Datadog Agent","href":"/vitess/tutorials/prometheus-metrics-datadog"},{"title":"Sending Prometheus Metrics to New Relic","sidebarTitle":"Forwarding metrics to New Relic","href":"/vitess/tutorials/prometheus-metrics-newrelic"},{"title":"Prometheus metrics","sidebarTitle":"Metrics List","href":"/vitess/integrations/prometheus-metrics"}]},{"group":"Integrations","pages":[{"title":"Datadog integration","sidebarTitle":"Datadog (legacy)","href":"/vitess/integrations/datadog"}]},{"group":"Database auditing","pages":[{"title":"Audit log","href":"/vitess/audit-log"}]}]},{"group":"Backups","pages":[{"title":"Back up and restore","href":"/vitess/backups"}]},{"group":"Scaling","pages":[{"title":"Cluster sizing","sidebarTitle":"Cluster sizing","href":"/vitess/scaling/cluster-sizing"},{"title":"Cluster configuration","href":"/vitess/scaling/cluster-configuration"},{"title":"Per-shard sizing","description":"Adjust VTTablet sizes for individual shards in a Vitess keyspace","href":"/vitess/cluster-configuration/per-shard-sizing"},{"title":"Database replicas","sidebarTitle":"Replicas","href":"/vitess/scaling/replicas"},{"title":"Read-only regions","description":null,"href":"/vitess/scaling/read-only-regions"},{"title":"Vitess system limits","href":"/vitess/scaling/planetscale-system-limits"},{"title":"VTGates","href":"/vitess/scaling/vtgates"},{"title":"Deleting a database","sidebarTitle":"Deleting a database","href":"/vitess/delete-a-database"}]},{"group":"Sharding","pages":[{"group":"Overview","pages":[{"title":"Sharding with PlanetScale","href":"/vitess/sharding"},{"title":"What are workflows?","sidebarTitle":"Workflows","href":"/vitess/scaling/workflows"}]},{"group":"Guides","pages":[{"title":"Shard existing tables with MoveTables","sidebarTitle":"Sharding quickstart","href":"/vitess/sharding/sharding-quickstart"},{"title":"Change the number of shards with MoveTables","sidebarTitle":"Modifying the number of shards","href":"/vitess/sharding/sharding-a-sharded-keyspace"},{"title":"Sharding new tables","sidebarTitle":"Sharding new tables","href":"/vitess/sharding/sharding-new-tables"},{"title":"Avoiding cross-shard queries","href":"/vitess/sharding/avoiding-cross-shard-queries"},{"title":"Targeting the correct keyspace","sidebarTitle":"Keyspace targeting for ORMs and frameworks","href":"/vitess/sharding/targeting-correct-keyspace"},{"title":"Sequence Tables","sidebarTitle":"Creating sequence tables","href":"/vitess/sharding/sequence-tables"},{"title":"Pre-sharding checklist","sidebarTitle":"Pre-sharding checklist","href":"/vitess/sharding/pre-sharding-checklist"}]},{"group":"Concepts","pages":[{"title":"VSchema","sidebarTitle":"VSchema","href":"/vitess/sharding/vschema"},{"title":"ALTER VSCHEMA syntax reference","sidebarTitle":"ALTER VSCHEMA syntax","href":"/vitess/sharding/alter-vschema"},{"title":"Vindexes","sidebarTitle":"Vindexes","href":"/vitess/sharding/vindexes"},{"title":"What is a keyspace","sidebarTitle":"Keyspace","href":"/vitess/sharding/keyspaces"},{"title":"Sharding workflow state reference","sidebarTitle":"Sharding workflow state reference","href":"/vitess/sharding/sharding-workflow-state-reference"}]}]},{"group":"Vectors","pages":[{"title":"Vector search and storage","sidebarTitle":"Vectors overview","href":"/vitess/vectors"},{"title":"Vector database terminology and concepts","sidebarTitle":"Concepts and terminology","href":"/vitess/vectors/terminology-and-concepts"},{"title":"Common use cases for Vector search","sidebarTitle":"Use cases","href":"/vitess/vectors/use-cases"},{"title":"Vectors with an ORM","sidebarTitle":"Using with an ORM","href":"/vitess/vectors/using-with-an-orm"},{"title":"Vector type and index reference","sidebarTitle":"Reference","href":"/vitess/vectors/reference"}]},{"group":"Security","pages":[{"title":"Security and compliance","sidebarTitle":"Overview","href":"/security"},{"title":"Vulnerability disclosure","href":"/security/vulnerability-disclosure"},{"group":"Database security","pages":[{"title":"Connection strings","href":"/vitess/security/connection-strings"},{"title":"Connecting to PlanetScale securely","sidebarTitle":"Secure connections","href":"/vitess/connecting/secure-connections"},{"title":"Password roles","href":"/vitess/security/password-roles"}]},{"group":"Account access","pages":[{"title":"Authentication methods","href":"/security/authentication-methods"},{"title":"Multi-factor authentication","href":"/security/multi-factor-authentication"},{"title":"Account password security","href":"/security/account-password-security"},{"title":"Security log","href":"/security/security-log"}]},{"group":"Organization access","pages":[{"title":"Access control","href":"/security/access-control"},{"title":"Audit log","href":"/security/audit-log"},{"title":"Teams","sidebarTitle":"Teams","href":"/security/teams"},{"title":"Single sign-on","href":"/security/sso"}]},{"group":"Database protection","pages":[{"title":"Deletion protection","sidebarTitle":"Deletion protection","href":"/security/deletion-protection"},{"title":"Require multiple administrators for deletion","sidebarTitle":"Multiple admins for deletion","href":"/security/multiple-admins-required-for-deletion"}]}]},{"group":"Troubleshooting","pages":[{"title":"MySQL compatibility","sidebarTitle":"MySQL compatibility","href":"/vitess/troubleshooting/mysql-compatibility"},{"title":"Vitess system limits","href":"/vitess/troubleshooting/planetscale-system-limits"},{"title":"PlanetScale database error reference","sidebarTitle":"Errors reference","href":"/vitess/troubleshooting/errors"},{"title":"Out of memory (OOM)","href":"/vitess/troubleshooting/out-of-memory"}]}]},{"group":"Integrations","pages":[{"group":"Development","pages":[{"title":"Cloudflare Workers database integration","sidebarTitle":"Cloudflare Workers","href":"/vitess/integrations/cloudflare-workers"},{"title":"Netlify","url":"https://docs.netlify.com/extend/install-and-use/setup-guides/planetscale-integration/","href":"/vitess/integrations/netlify"},{"title":"Deploy to Vercel","sidebarTitle":"Vercel","href":"/vitess/tutorials/deploy-to-vercel"},{"title":"AWS Lambda connection strings","sidebarTitle":"AWS Lambda","href":"/vitess/tutorials/aws-lambda-connection-strings"}]},{"group":"ETL","pages":[{"title":"PlanetScale Connect","sidebarTitle":"Overview","href":"/vitess/etl"},{"title":"Airbyte integration","sidebarTitle":"Airbyte","href":"/vitess/integrations/airbyte"},{"title":"Artie integration","sidebarTitle":"Artie","href":"/vitess/integrations/artie"},{"title":"Fivetran integration","sidebarTitle":"Fivetran","href":"/vitess/integrations/fivetran"},{"title":"Hightouch integration","sidebarTitle":"Hightouch","href":"/vitess/integrations/hightouch"},{"title":"Stitch integration","sidebarTitle":"Stitch","href":"/vitess/integrations/stitch"},{"group":"Debezium","pages":[{"title":"Debezium connector for PlanetScale","sidebarTitle":"Debezium","href":"/vitess/integrations/debezium"},{"title":"Debezium connector on Confluent Cloud","sidebarTitle":"Confluent Cloud","href":"/vitess/integrations/debezium-confluent"}]}]},{"group":"Monitoring","pages":[{"title":"Prometheus","sidebarTitle":"Prometheus","href":"/vitess/tutorials/prometheus"},{"title":"Grafana Dashboard for PlanetScale Branches","sidebarTitle":"Grafana","href":"/vitess/monitoring/prometheus-metrics-grafana"},{"title":"Sending Prometheus Metrics to Datadog","sidebarTitle":"Datadog Agent","href":"/vitess/monitoring/prometheus-metrics-datadog"},{"title":"Sending Prometheus Metrics to New Relic","sidebarTitle":"New Relic","href":"/vitess/monitoring/prometheus-metrics-newrelic"},{"title":"Datadog integration","sidebarTitle":"Datadog (legacy)","href":"/vitess/monitoring/datadog"}]},{"group":"Billing","pages":[{"title":"Vantage integration","sidebarTitle":"Vantage","href":"/vitess/integrations/vantage"}]}]},{"group":"Guides","pages":[{"group":"Frameworks and ORMs","pages":[{"title":"Connect a Django application to PlanetScale","sidebarTitle":"Django","href":"/vitess/tutorials/connect-django-app"},{"group":"Golang","pages":[{"title":"Connect a Go application to PlanetScale","sidebarTitle":"Go quickstart","href":"/vitess/tutorials/connect-go-app"},{"title":"Connect a Go application using GORM to PlanetScale","sidebarTitle":"Gorm","href":"/vitess/tutorials/connect-go-gorm-app"}]},{"group":"Next.js","pages":[{"title":"Connect a Next.js application to PlanetScale","sidebarTitle":"Next.js quickstart","href":"/vitess/tutorials/connect-nextjs-app"},{"title":"Next.js and PlanetScale Netlify template tutorial","sidebarTitle":"Next.js and Netlify template","href":"/vitess/tutorials/nextjs-planetscale-netlify-template"},{"title":"Deploy to Vercel","sidebarTitle":"Deploy to Vercel","href":"/vitess/tutorials/nextjs-deploy-to-vercel"},{"title":"Deploy to Netlify","sidebarTitle":"Deploy to Netlify","href":"/vitess/tutorials/deploy-to-netlify"}]},{"title":"Connect a Node.js application to PlanetScale","sidebarTitle":"Node.js","href":"/vitess/tutorials/connect-nodejs-app"},{"group":"PHP","pages":[{"title":"Connect a PHP application to PlanetScale","sidebarTitle":"PHP quickstart","href":"/vitess/tutorials/connect-php-app"},{"title":"Connect a Laravel application to PlanetScale","sidebarTitle":"Laravel quickstart","href":"/vitess/tutorials/connect-laravel-app"},{"title":"Connect a Symfony application to PlanetScale","sidebarTitle":"Symfony quickstart","href":"/vitess/tutorials/connect-symfony-app"}]},{"group":"Prisma","pages":[{"title":"Using PlanetScale with Prisma","sidebarTitle":"Prisma guide","href":"/vitess/tutorials/using-planetscale-with-prisma"},{"title":"Automatic Prisma migrations","sidebarTitle":"Automatic Prisma migrations","href":"/vitess/tutorials/automatic-prisma-migrations"},{"title":"Using the PlanetScale serverless driver with Prisma","sidebarTitle":"Serverless driver with Prisma","href":"/vitess/tutorials/planetscale-serverless-driver-prisma-example"},{"title":"Prisma best practices","href":"/vitess/tutorials/prisma-best-practices"}]},{"group":"Ruby on Rails","pages":[{"title":"Connect a Rails application to PlanetScale","sidebarTitle":"Ruby on Rails quickstart","href":"/vitess/tutorials/connect-rails-app"},{"title":"Automatic Rails migrations","sidebarTitle":"Automatic Rails migrations","href":"/vitess/tutorials/automatic-rails-migrations"}]}]},{"group":"Deployments","pages":[{"title":"Deploy to Netlify","sidebarTitle":"Deploy to Netlify","href":"/vitess/tutorials/deployments/deploy-to-netlify"},{"title":"Deploy to Vercel","href":"/vitess/tutorials/deployments/deploy-to-vercel"},{"title":"Next.js and PlanetScale Netlify template tutorial","sidebarTitle":"Next.js and Netlify template","href":"/vitess/tutorials/deployments/nextjs-planetscale-netlify-template"},{"title":"Deploy a Django app to Heroku","href":"/vitess/tutorials/deploy-a-django-app-to-heroku"}]},{"group":"Monitoring","pages":[{"title":"Grafana Dashboard for PlanetScale Branches","sidebarTitle":"Visualizing in Grafana","href":"/vitess/guides/prometheus-metrics-grafana"},{"title":"Sending Prometheus Metrics to Datadog","sidebarTitle":"Sending Prometheus Metrics to Datadog","href":"/vitess/guides/prometheus-metrics-datadog"},{"title":"Sending Prometheus Metrics to New Relic","sidebarTitle":"Sending Prometheus Metrics to New Relic","href":"/vitess/guides/prometheus-metrics-newrelic"}]},{"group":"Serverless JavaScript driver","pages":[{"title":"PlanetScale serverless driver for JavaScript","sidebarTitle":"Using the serverless driver","href":"/vitess/tutorials/planetscale-serverless-driver"},{"title":"Node.js example using the PlanetScale serverless driver","sidebarTitle":"Node.js example","href":"/vitess/tutorials/planetscale-serverless-driver-node-example"},{"title":"Using the PlanetScale serverless driver with Prisma","sidebarTitle":"Prisma example","href":"/vitess/tutorials/prisma-example"}]},{"group":"MySQL","pages":[{"title":"Operating without foreign key constraints","sidebarTitle":"Operating without foreign key constraints","href":"/vitess/operating-without-foreign-key-constraints"},{"title":"How to make different types of schema changes","sidebarTitle":"Performing different types of schema changes","href":"/vitess/how-to-make-different-types-of-schema-changes"},{"title":"How Online Schema Change tools work","sidebarTitle":"How online schema change tools work","href":"/vitess/schema-changes/how-online-schema-change-tools-work"},{"title":"Online DDL change unique keys","sidebarTitle":"OnlineDDL","href":"/vitess/onlineddl-change-unique-keys"},{"title":"Strategies for maintaining referential integrity","sidebarTitle":"Changing unique keys","href":"/vitess/strategies-for-maintaining-referential-integrity"},{"title":"Handling table and column renames","sidebarTitle":"Renaming columns and tables","href":"/vitess/handling-table-and-column-renames"},{"title":"Comparison of Online Schema Change tools","sidebarTitle":"Online schema change tool comparison","href":"/vitess/schema-changes/online-schema-change-tools-comparison"}]}]}]},{"tab":"Neki","pages":[{"title":"Neki","href":"/neki"}]},{"tab":"Postgres","pages":[{"title":"Postgres","href":"/postgres"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api/reference/getting-started-with-planetscale-api"}]},{"tab":"CLI Reference","pages":[{"title":"CLI Reference","href":"/cli"}]}]},"basePath":"","title":"Database replicas - PlanetScale","buildId":"dpl_4RHMRqtvdHvKgaEfTTjFqjzja3B6","deploymentId":"dpl_4RHMRqtvdHvKgaEfTTjFqjzja3B6","dynamics":[],"chunks":[]}