Skip to main content
Read-only mode preserves cluster functionality while preventing operations that could lead to instability, allowing you to remediate issues before they become critical. When read-only mode is enabled, attempts to write to the cluster will see the following error:
invalid statement because cluster is read-only
There’s no way for a PlanetScale customer to enter or exit read-only mode, except by remediating the conditions that caused the cluster to enter that mode. Here are the reasons we’ll put the cluster into read-only mode:

Insufficient space

To protect your cluster from crashing, if a cluster has very little space left (typically 5% or less), we will automatically move it into read-only mode. The specific scenarios are:
Storage TypeScenarioRemediation
Network-attached storageClusters with Autoscaling disabled or where your current disk size is approaching your configured Autoscaling maximumIncrease the cluster disk size manually or increase the storage limit on disk autoscaling
PlanetScale MetalWhen your data is approaching the storage size of your clusterIncrease the cluster size
Once you have remediated the issue, your cluster will automatically exit read-only mode.
PlanetScale will send notifications via email and webhook (if enabled) when your storage exceeds 60, 75, 85, 90, and 95 percent, respectively. You can also track disk utilization via Metrics. Emails are sent to all Organization and Database administrators. It is critical that these email addresses are monitored regularly.
If the issue was temporary, say due to errant data being written by mistake, you could remove the data, perform a vacuum, and then reverse the remediation action. See Managing Storage for more on reducing storage usage.

Replication lag

If your cluster reaches an extremely high amount of replication lag, we’ll also put the cluster in read-only mode. Specifically, we monitor replication lag of all replicas compared to the setting max_slot_wal_keep_size which we default to 4GB. If all replicas go over that lag amount, we will enable read-only mode. At that point, because we use quorum based synchronous replication, at the point your replication lag is this high, you will see write transactions take minutes or longer to apply to the cluster (even before read-only mode). We enable read-only mode in that situation to ensure replicas have some time to catch up without any write traffic. If you see this happening frequently, we recommend sizing your cluster up, or upgrading to a metal cluster in order to keep up with high rates of write traffic.
I