What Is Read replica in Databases?
On This Page
Quick Definition
A read replica is a separate copy of your database that you can only read from, not write to. It helps spread out the work when many people are trying to read data at the same time. The primary database keeps handling writes and updates, while the read replica keeps itself in sync by copying changes automatically.
Commonly Confused With
Multi-AZ is a high-availability feature that maintains a synchronous standby replica in a different availability zone. If the primary fails, AWS automatically fails over to the standby with no manual intervention. Unlike a read replica, the standby in a Multi-AZ setup does not serve read traffic by default; it is only used for failover. Read replicas are for read scaling, and they use asynchronous replication. Multi-AZ uses synchronous replication and is not intended for scaling read workloads.
If you want automatic failover after a disaster, choose Multi-AZ. If your app is slow because too many people are reading the database, choose a read replica.
A standby database is a copy used for disaster recovery, not for read traffic. It is often kept in synced state but may not accept connections during normal operations. A read replica, on the other hand, is actively serving read queries. Standby databases may use synchronous or asynchronous replication, but read replicas always serve reads. In some contexts, a read replica can also serve as a standby if promoted, but they are not the same.
A standby database sits idle until a failure happens. A read replica is busy helping users read data every second.
Sharding splits data across multiple database instances by a shard key so that each instance holds a subset of the data. This scales both reads and writes because each shard handles its own writes independently. A read replica holds a full copy of the same data and only scales reads. Sharding is more complex and is used when write throughput is the bottleneck; read replicas are simpler and used when read throughput is the bottleneck without write issues.
If you have too many users writing to the database, you need sharding. If you have many users reading but only one application writing, you need read replicas.
Must Know for Exams
Read replicas appear frequently in several major certification exams, especially those offered by AWS, Google Cloud, and Microsoft Azure. In the AWS Certified Solutions Architect Associate exam, you can expect questions that ask you to design a scalable database tier for a web application. The exam will test your ability to distinguish between a Multi-AZ deployment and a read replica. A typical question might describe an application where the primary database is being overwhelmed by read queries, and you must choose the best solution. The correct answer is usually to enable read replicas, not to upgrade to a larger instance or enable Multi-AZ. The exam also tests your understanding that read replicas provide eventual consistency and cannot be used for write scaling. You might be asked what to do if the primary database fails, and the correct answer might be to promote a read replica, but only if it is fully synced. Alternatively, the exam may ask about Multi-AZ and read replica differences, and you need to know that Multi-AZ is for high availability with automatic failover, whereas read replicas are for read scaling with manual promotion.
In the Google Cloud Professional Data Engineer exam, read replicas are covered under Cloud SQL and Spanner. You must understand that Cloud SQL supports read replicas for MySQL and PostgreSQL, and they use asynchronous replication. Questions may ask about reducing read latency for global users, and the solution might involve creating read replicas in different regions. The exam also tests your knowledge of replication lag and how to monitor it using Cloud Monitoring. In the Azure Database Administrator exam, you need to know about read replicas in Azure SQL Database and Azure Database for MySQL/PostgreSQL. Microsoft uses the term "read-scale replicas" and requires you to understand that they use asynchronous replication. You might be asked to configure a read replica for a reporting workload that should not impact transactional throughput. You need to know that you can have up to five read replicas per primary in Azure Database for MySQL, and that replicas can be in the same region or cross-region.
For general IT certifications like CompTIA Cloud+, the concept of read replicas appears but at a higher level. You are expected to know that read replicas improve read performance and availability, but the deep technical replication details are less emphasized. In the AWS Certified Database Specialty exam, read replicas are covered in much more depth, including replication methods, monitoring lag, and failover procedures. Questions can be quite detailed, such as which replication type (row-based vs. statement-based) to use in specific scenarios. For any exam, you should remember that read replicas do not provide automatic failover, do not improve write performance, and introduce eventual consistency. The most common trick question is offering a read replica as a solution for high write throughput, that is wrong. The exam also may ask about the number of read replicas allowed (varies by service), replication lag monitoring, and how to handle replica failure. Reviewing the official documentation for the specific exam's cloud provider is essential. Overall, read replicas are a high-yield topic because they appear in multiple objective domains related to scalability, high availability, and database management.
Simple Meaning
Think of a read replica like a photocopy of a very important document that you keep in a different room. The original document stays on your desk, and that is the only place where you can write new notes or make changes. But dozens of people need to read that document every day. If they all crowd around your desk, nobody can get much done. So you make a perfect photocopy and put it in a reading room. People can go to the reading room, look at the copy, and leave without ever touching your desk. The copy gets updated whenever you make a change to the original, because someone runs a fresh photocopy every few seconds. That is exactly what a read replica does in a database. The primary database is the only one that accepts write operations, like inserting new customer orders or updating account balances. The read replica is a read-only copy that can be used to serve SELECT queries, reports, or dashboard queries. This separation of duties means that heavy read traffic never slows down the write operations. The replica stays up to date by replaying the same changes that happen on the primary, usually through a technology called replication. The key point is that the replica is not a backup in the traditional sense, because it is always online and actively serving traffic. It is a live copy that helps you scale your application horizontally for reading. It is also a great way to improve availability, because if the primary goes down (at least temporarily), you can sometimes promote the replica to become the new primary. But while it is a replica, it is strictly read-only. If someone tries to update a row in the replica, the database will reject that operation because the replica is not designed to accept changes directly.
So the whole idea is about dividing the work: one database does all the writing, and one or more replicas do all the heavy reading. This allows the primary to stay fast and responsive for critical transactions, while the replicas handle large analytical queries, report generation, or user-facing read requests that don't require immediate consistency. The data on the replica might be a few milliseconds behind the primary, but for most use cases that delay is perfectly acceptable. This concept is common in cloud databases like Amazon RDS, Google Cloud SQL, and Azure SQL Database, as well as in on-premise systems like MySQL and PostgreSQL. Understanding read replicas is essential when you are studying for IT certification exams that cover database scalability, high availability, and disaster recovery.
Full Technical Definition
A read replica is a secondary database instance that maintains an asynchronous (or sometimes synchronous) copy of data from a primary database instance. The purpose is to offload read-intensive queries from the primary database, thereby improving overall system performance and scalability. The replication process is typically based on the database engine's native replication mechanism. In MySQL, for example, the primary writes all changes to a binary log. The replica connects to the primary as a replication client, reads the binary log, and applies those changes to its own data files using the relay log. This process is called statement-based replication or row-based replication, depending on configuration. In PostgreSQL, the primary writes a Write-Ahead Log (WAL), and the replica receives and replays those WAL records in a process called streaming replication. The replica runs in hot standby mode, allowing read-only queries while the WAL is applied continuously.
The replica is not a passive backup; it is an active participant in the database architecture. It is configured with a different endpoint so that applications can direct read queries to it. The replication lag, which is the time delay between a write on the primary and its appearance on the replica, is a critical metric to monitor. Under normal conditions, lag is usually sub-second, but it can grow during periods of heavy write activity or network congestion. For exam purposes, it is important to understand that read replicas do not provide automatic failover without additional tools. In Amazon RDS, for instance, you can promote a read replica to a standalone database instance, which breaks the replication relationship and makes the replica writable. However, this is a manual operation or can be automated with Multi-AZ deployments, but Multi-AZ is a different architecture from a read replica. Multi-AZ uses synchronous replication for high availability, while read replicas use asynchronous replication for read scaling.
Another technical detail is that read replicas can have their own replicas, forming a replication chain, though this adds complexity and increases lag. In terms of consistency, read replicas offer eventual consistency because there is a lag between the primary and replica. Applications must tolerate reading slightly stale data. If an application needs immediate consistency after a write, it must route that read to the primary. In cloud environments, you can create multiple read replicas in different Availability Zones to improve both read performance and disaster recovery readiness. The cost is additional storage and compute resources, as each replica is a full database instance. For certification exams, you need to know that read replicas are primarily used for read scalability, not for disaster recovery. While a read replica can be promoted during a disaster, it is not the same as a Multi-AZ failover because there is no built-in automatic promotion and the replica may not be in sync if the primary fails unexpectedly. Also, read replicas do not help with write scalability; if your bottleneck is write throughput, you need sharding or a different solution.
Overall, read replicas are a fundamental building block for scaling database workloads in cloud and enterprise environments. They are tested in exams such as AWS Certified Solutions Architect, AWS Certified Database, Google Cloud Professional Data Engineer, and Azure Database Administrator. Understanding how replication works, what replication lag is, and the difference between read replicas and Multi-AZ deployments is key to answering exam questions correctly.
Real-Life Example
Imagine a busy public library with a single librarian working at the front desk. The librarian is the only person who can check books in and out, add new books to the catalog, or remove old ones. In other words, the librarian handles all the updates to the library system. But a lot of people just want to browse the shelves and see what books are available. If every person who wants to look at the catalog has to stand in line at the librarian's desk, the librarian can’t get any actual work done, and the line grows very long. To solve this problem, the library creates a large, printed catalog book that is a snapshot of the card catalog at that moment. They put several copies of this book on tables around the library. People can walk up to any table, open the catalog book, and look up a book by title or author. They don’t need to bother the librarian. But if someone returns a book or a new book arrives, the librarian updates the main catalog, and every night a new printed catalog is produced and placed on the tables. The information might be a few hours old, but that is acceptable because most people only need to know where a book is, not the exact second it was returned.
That printed catalog book is a read replica. The librarian is the primary database, and each printed catalog book is a replica that can handle read queries. The printed catalog book is read-only, nobody can write a new entry into it. If someone wants to check out a book, they have to go to the librarian (the primary database). The library can also make many copies of the printed catalog and put them in different rooms, just like you can create multiple read replicas in different cloud regions or availability zones. The delay between the master catalog update and the printed catalog being updated is the replication lag. In the real world, the lag might be a day; in a database, it is usually a few seconds or milliseconds. This arrangement means the library can serve many more visitors without making the librarian slower. If the librarian gets sick one day, the printed catalogs still exist, but nobody can check books in or out. Similarly, if the primary database fails, the read replicas still have data but cannot accept writes until you promote one to be the new primary. The analogy helps explain why read replicas improve read performance but do not automatically make the system highly available for writes.
Why This Term Matters
In practical IT, read replicas are one of the most effective and cost-efficient ways to scale database performance without redesigning the application. Modern applications serve millions of users who constantly read data, whether it is product listings, user profiles, news feeds, or analytics dashboards. The primary database is already busy handling write transactions, such as placing orders, updating profiles, or logging events. If you force all read queries through the same database instance, you will eventually hit a resource bottleneck. CPU usage spikes, memory fills with query caches, and disk I/O becomes saturated. The entire application slows down, and users see timeouts. Read replicas solve this by distributing the read workload across multiple instances. You can add replicas as needed and remove them when demand drops. In cloud environments, this scaling can be automated with read replicas being created and destroyed based on traffic patterns.
Another reason read replicas matter is for operational tasks. Running heavy analytical queries or generating large reports can lock tables or consume resources that degrade user-facing performance. By directing those queries to a read replica, you protect the primary database from performance degradation. Read replicas can be used for data recovery in case of accidental data modification on the primary. Because replication is asynchronous, you can stop replication at a point in time before the error occurred, and then use the replica to recover the lost data. This is not the primary purpose, but it is a common practical use. For businesses that require high availability across regions, read replicas can be placed in different geographic locations. Users in Europe can be directed to a read replica in Frankfurt, while the primary database remains in North America. This reduces latency for read-heavy applications and improves user experience.
Finally, read replicas matter because they are a core concept in cloud certification exams. Knowing the difference between read replicas and Multi-AZ deployments, understanding when to use synchronous vs. asynchronous replication, and being able to diagnose replication lag are all skills tested in real exam scenarios. In a production environment, a sysadmin or cloud architect must be able to design a database tier that scales reads cost-effectively. Read replicas are the go-to solution because they are simple to set up, supported by all major cloud providers, and require minimal configuration on the application side (just a separate connection string for reads). The trade-off in eventual consistency is usually acceptable for most use cases, but knowing when it is not acceptable is a sign of a skilled practitioner. That is why read replicas matter, they directly affect performance, availability, cost, and exam success.
How It Appears in Exam Questions
Exam questions about read replicas usually fall into three categories: scenario-based, configuration-based, and troubleshooting. In scenario-based questions, you are given a description of an application experiencing database performance problems. For example, "An e-commerce site has a single MySQL database running on an EC2 instance. During a flash sale, the database CPU remains at 95% and users report slow page loads. The database handles both inventory updates and product catalog reads. What is the most cost-effective way to reduce the load on the database?" The correct answer would be to create a read replica and route the catalog queries to it. The exam might also present a scenario where a primary database fails, and ask how to restore service. If there is a read replica, the answer might be to promote it to a standalone database, but the exam will also test that you cannot promote a read replica that is lagging behind and expect a lossless failover.
Configuration-based questions require you to know the steps to create a read replica or modify its settings. For example, "A developer needs to create a read replica for an Amazon RDS for PostgreSQL instance. Which parameter must be set to enable automatic backups on the primary?" (Answer: backup_retention_period must be set to a value greater than 0 because read replicas require automatic backups on the primary). Another config question might ask: "When creating a cross-region read replica in Amazon RDS, what must be enabled on the source DB instance?" (Answer: automatic backups must be enabled and the source must be in a region that supports cross-region replication). For Google Cloud, you might be asked about the command to create a Cloud SQL read replica using gcloud: gcloud sql instances create <replica-name> --master-instance-name=<master-name> --region=<region>.
Troubleshooting questions focus on replication lag and consistency. For instance, "After creating a read replica for a busy MySQL database, users report that the data in the replica is several minutes old. Which metric should you monitor to confirm the issue?" (Answer: ReplicaLag in Amazon RDS or Seconds_Behind_Master in MySQL). A common troubleshooting scenario involves an application that writes data and then immediately tries to read that data from a read replica, but the read returns stale data. The question will ask what the best practice is to avoid this inconsistency. The answer is to read from the primary database immediately after a write, or to use session-level consistency controls. Another troubleshooting question might involve a scenario where a read replica cannot be created because automatic backups are not enabled on the primary, or the binary logging is disabled. The candidate must identify the missing configuration. Finally, exam questions sometimes ask about the limitations of read replicas. For example, "Which statement is true about read replicas in Amazon RDS?" The correct options might include that they are available only for InnoDB storage engine (for MySQL), that you cannot have a read replica of a read replica (though some providers support it), or that a read replica can be promoted to a standalone instance. Knowing these boundaries is crucial for answering accurately.
Practise Read replica Questions
Test your understanding with exam-style practice questions.
Example Scenario
A company runs a news website that stores all articles, comments, and user profiles in a single Amazon RDS for MySQL database. The website has a fairly steady number of visitors, but when a major story breaks, traffic spikes dramatically. During these peaks, the database CPU stays at 90-99% and page loads become very slow. The application primarily does two things: users read articles (SELECT statements) and users post comments (INSERT statements). The reading happens about 80% of the time, and writing only 20%. However, the single database instance must handle both, and the reading activity is what causes the CPU bottleneck. The company wants a solution that is quick to implement, cost-effective, and does not require rewriting the application code unless absolutely necessary.
The solution is to create a read replica of the primary database. The developer logs into the AWS Management Console, selects the RDS instance, and uses the "Create read replica" option. The replica is launched in the same region (but in a different availability zone for resilience). After a few minutes, the replica is available at its own endpoint. The developer then modifies the application configuration so that all SELECT queries (reads) are sent to the replica endpoint, while all INSERT, UPDATE, and DELETE queries (writes) continue to be sent to the primary database endpoint. The application uses a simple driver-level routing that separates reads and writes. Once this change is deployed, the primary database CPU drops from 95% to 40% because it is only handling the write workload. The replica's CPU sits at around 50%, handling all the read queries. The page load times return to normal even during traffic spikes. The company monitors replication lag using Amazon CloudWatch. During normal operation, the lag is less than one second. However, during the initial spike, the lag temporarily increased to two seconds before returning to normal. The developers decide that this is acceptable because users do not need to see the most recent comment immediately after posting; a two-second delay is fine.
Later, the company decides to run a long analytics query to generate a report of all comments from the past year. Instead of running this heavy query on the primary database, they run it on the read replica. This prevents the analytics workload from affecting the performance of the live website. The example shows how read replicas solve real-world scaling problems without architectural overhauls. It also demonstrates the need to handle replication lag and the tradeoff between eventual consistency and performance.
Common Mistakes
Thinking a read replica provides automatic failover like a Multi-AZ deployment.
A read replica is not designed for automatic failover. It uses asynchronous replication, so the replica may not have all the latest data when the primary fails. Failover requires manual promotion, which is not automatic or instantaneous. Multi-AZ deployments use synchronous replication and automatic failover, which are different features.
If you need automatic failover with no data loss, use Multi-AZ or a similar synchronous replication solution. If you need read scaling with occasional manual failover, use a read replica.
Believing a read replica can improve write performance.
A read replica only handles read queries. Write operations always go to the primary database. Adding a read replica does nothing to reduce the load of INSERTs, UPDATEs, or DELETEs on the primary. The primary remains the bottleneck for write throughput.
To improve write performance, you need to consider scaling up the primary instance (vertical scaling) or sharding the database (horizontal scaling). Read replicas are for read scaling only.
Assuming data on a read replica is always identical to the primary (strong consistency).
Replication is asynchronous, meaning there is always some delay, known as replication lag. During high write activity, the lag can be several seconds or more. Applications reading from a replica may see stale data. This is called eventual consistency, not strong consistency.
Design your application to tolerate eventual consistency for reads from the replica. If an operation requires reading its own write, route that read to the primary database. Use session tokens or read-after-write consistency features if available.
Forgetting to enable automatic backups on the primary before creating a read replica (in AWS RDS).
Amazon RDS requires automatic backups to be enabled on the primary to support replication, because the backup retention period is used for the binary log retention that the replica needs to sync. Without automatic backups, you cannot create a read replica.
Before creating a read replica, ensure that the primary DB instance has automatic backups enabled with a retention period of at least 1 day. This is a prerequisite in AWS and also applies to some other managed services.
Exam Trap — Don't Get Fooled
{"trap":"An exam question describes a database that is handling a lot of write traffic (high INSERT/UPDATE rate) and someone suggests adding a read replica to fix the problem.","why_learners_choose_it":"Learners often see 'read replica' as a generic performance booster and assume it helps with all types of database load. They may not carefully read the question to see that the bottleneck is write traffic, not read traffic.
The term 'replica' implies more resources, so they think it will help generally.","how_to_avoid_it":"Always identify whether the bottleneck is read-heavy or write-heavy. Read replicas only help with read queries.
If the question mentions high write volume, look for solutions like upgrading the instance size, using write sharding, or migrating to a database with higher write throughput. Never pick a read replica as a solution for write performance issues."
Step-by-Step Breakdown
Identify the need for a read replica
Monitor the primary database for high CPU, memory, or IOPS usage caused by read queries. If the database is handling more SELECT queries than it can efficiently process, and write performance is still acceptable, a read replica is a good solution. The goal is to offload read traffic.
Ensure prerequisites are met
For managed services like Amazon RDS, automatic backups must be enabled on the primary instance. For self-managed databases, binary logging (MySQL) or WAL archiving (PostgreSQL) must be active. Without these, the replica cannot receive change data from the primary. Also, the primary must be in an appropriate version and storage type.
Create the read replica
In a cloud console or via CLI, select the option to create a read replica. You will specify the source primary instance, a name for the replica, the region and availability zone, and optionally a different instance class or storage type. The service will take a snapshot of the primary and provision a new instance that begins replication from that snapshot.
Monitor replication lag
After creation, the replica continuously applies changes from the primary. Replication lag is the time difference between the last applied change on the replica and the current state of the primary. Use monitoring tools (CloudWatch, pg_stat_replication, SHOW SLAVE STATUS) to track lag. A lag of zero or under a second is healthy. Increasing lag indicates a problem.
Route read traffic to the replica
Modify the application configuration to use a separate database endpoint for read operations. The primary endpoint remains for writes. This can be done at the application level (read/write splitting) or using a proxy like ProxySQL or Amazon RDS Proxy. After routing, verify that read queries hit the replica and writes go to the primary.
Monitor and maintain the replica
Regularly check the health of the replica, replication lag, and storage space. If the replica fails or lags too much, you may need to delete and recreate it. If the primary fails, you can promote the replica to a standalone instance (this stops replication). After promotion, the replica becomes a writable database that can act as the new primary.
Practical Mini-Lesson
In practice, setting up a read replica requires careful planning beyond just clicking a button. The first decision is whether to create the replica in the same region or a different region. Same-region replicas provide low-latency reads for local users and help with availability zone resilience. Cross-region replicas reduce latency for global users and provide disaster recovery, but they have higher replication lag due to network distance. When creating a cross-region replica, you must ensure the source region supports cross-region replication and that the target region has sufficient capacity. In AWS, you cannot create a cross-region read replica for a DB instance that uses the SQL Server engine, but it is supported for MySQL, MariaDB, PostgreSQL, and Oracle.
Another practical concern is the impact of replication on the primary. The primary must retain binary logs or WAL files until the replica has consumed them. This uses disk space on the primary. If replication lags for a long time, the primary may run out of storage because it cannot delete old logs. Monitoring replication lag and setting up alarms is essential. For self-managed MySQL, you can monitor Seconds_Behind_Master from the replica. For Amazon RDS, you can use the ReplicaLag CloudWatch metric. If lag grows, you can increase the instance size of the replica or check for long-running queries on the replica that block replay of logs.
What can go wrong? One common failure is the replica becoming permanently out of sync due to network issues, errors in applying changes (e.g., the replica runs out of disk space, or there is a data conflict if someone mistakenly wrote to the replica directly). In that case, you must rebuild the replica from scratch. Another issue is that some database engines require specific storage engines or configurations. For MySQL read replicas on RDS, the primary must use the InnoDB engine because MyISAM does not support replication. Also, you cannot create a read replica of a read replica in Amazon RDS, though some other platforms allow it. In production, you often create multiple read replicas to distribute the read load further, but each additional replica adds load on the primary because each one must read the binary log.
Professionals also use read replicas for specific use cases like data warehousing or analytics. For example, you can create a read replica, then run complex analytical queries that might lock tables, without affecting the primary. However, if those analytical queries are heavy, they can slow down the replication process, increasing lag. A better approach is to use a different engine like Amazon Redshift for analytics, but that is more expensive. In a cloud environment, you can also use read replicas for testing and staging environments, because they have near-real-time data without affecting the primary. Just remember that if you promote a replica, it becomes a separate database that no longer syncs with the original primary. So if you use a replica for testing and then decide to promote it, you will have two independent databases. This can be a deliberate strategy for creating a development environment with production-like data, but you must be careful with the promotion step.
Finally, a critical operational task is handling failover. If the primary database fails, you have choices: you can wait for the primary to recover, or you can promote a read replica to a new primary. Promotion is a manual operation in most services (except when using additional tools like Amazon RDS Proxy). When promoting, you must ensure the replica is as up to date as possible. In the worst case, you may lose some recent transactions that were not yet replicated. This is why asynchronous replication is not a substitute for synchronous high-availability solutions. In exams, you will often be asked to choose between a read replica and Multi-AZ based on the RPO (Recovery Point Objective) and RTO (Recovery Time Objective) requirements. If the RPO is zero, you need synchronous replication (Multi-AZ or similar). If you can tolerate a few seconds of data loss, a read replica may be acceptable.
Memory Tip
Remember: Read replicas are for Read traffic and Read-only; they do Not help with Writes and do Not fail over automatically.
Covered in These Exams
Current Exam Context
Current exam versions that test this topic — use these objectives when studying.
SAA-C03SAA-C03 →N10-009CompTIA Network+ →220-1101CompTIA A+ Core 1 →AZ-900AZ-900 →DP-900DP-900 →AI-900AI-900 →SOA-C02SOA-C02 →PCAGoogle PCA →CDLGoogle CDL →Related Glossary Terms
Two-factor authentication (2FA) is a security method that requires two different types of proof before granting access to an account or system.
An A record is a type of DNS resource record that maps a domain name to an IPv4 address.
AAA (Authentication, Authorization, and Accounting) is a security framework that controls who can access a network, what they are allowed to do, and tracks what they did.
Frequently Asked Questions
Can I write data to a read replica?
No, a read replica is strictly read-only. Any attempt to write to it will fail. The only way to modify data on a read replica is to promote it to a standalone (writable) instance, which breaks the replication link.
How many read replicas can I have?
It depends on the database service. In Amazon RDS for MySQL and MariaDB, you can have up to 5 read replicas per primary. In PostgreSQL on RDS, you can have up to 5 as well. Google Cloud SQL allows up to 10 read replicas. Check the specific service limits for your environment.
What is replication lag and why is it important?
Replication lag is the time delay between a change occurring on the primary database and that change appearing on the read replica. It is important because applications reading from a replica may see stale data if the lag is high. Monitoring lag helps you ensure data freshness and detect problems with the replication process.
Is a read replica the same as a backup?
No, a read replica is not a backup. It is a live, read-only copy of the database used for scaling reads. A backup is a point-in-time snapshot stored in a separate location for disaster recovery. While a read replica can be used to recover data if the primary fails (by promoting it), it does not replace the need for regular backups.
Does a read replica require a separate license or cost?
Yes, a read replica incurs additional costs for compute, storage, and sometimes licensing fees depending on the database engine. In AWS and other cloud providers, you pay for the replica instance as a separate resource. It is not free, so you should consider cost when scaling.
What happens to the read replica when I modify the primary database schema (ALTER TABLE)?
DDL changes (like ALTER TABLE) are replicated to the read replica just like DML changes. However, during the DDL execution, replication may lag because the DDL command takes time to apply on the replica. Some DDL operations can cause locks on the replica, affecting its ability to serve read queries. It is best to perform schema changes during low traffic periods.
Can I create a read replica in a different region?
Yes, many cloud providers support cross-region read replicas. This is useful for reducing latency for global users and for disaster recovery. However, cross-region replication typically has higher lag due to network distance, and you may incur data transfer costs.
Summary
A read replica is a read-only copy of a database that helps scale read-intensive workloads by offloading SELECT queries from the primary database. It works by continuously replicating changes from the primary using an asynchronous process such as binary log replay (MySQL) or WAL streaming (PostgreSQL). The main benefits are improved read performance, the ability to handle large analytic queries without affecting transactional workloads, and the potential for cross-region data distribution.
However, it is important to remember that read replicas do not improve write performance, do not provide automatic failover, and introduce eventual consistency with replication lag. In certification exams, you will encounter scenarios asking you to differentiate read replicas from Multi-AZ deployments, understand when to use them, and identify limitations such as the requirement for backups to be enabled. Common mistakes include thinking a read replica can handle write spikes or provide automatic failover.
By mastering the concept of read replicas, you gain a practical tool for database scaling and a solid foundation for answering exam questions in AWS, GCP, Azure, and other platforms. Always keep in mind that read replicas are about scaling reads, not writes, and they are not a substitute for high-availability solutions that require zero data loss.