<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ReadySet</title>
    <description>The latest articles on DEV Community by ReadySet (@readyset).</description>
    <link>https://dev.to/readyset</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1232832%2Fad488c0d-7def-48e6-a0e2-b8ad5355fabe.png</url>
      <title>DEV Community: ReadySet</title>
      <link>https://dev.to/readyset</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/readyset"/>
    <language>en</language>
    <item>
      <title>Monitor Readyset with Percona PMM</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Tue, 17 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/monitor-readyset-with-percona-pmm-2odj</link>
      <guid>https://dev.to/readyset/monitor-readyset-with-percona-pmm-2odj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiwv5vlzr1qu4h2t2dd0y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fiwv5vlzr1qu4h2t2dd0y.png" alt="Monitor Readyset with Percona PMM" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When an application starts reading through Readyset, the database sees fewer requests for cached queries. That's a useful change to see in PMM. But we'd also like to follow the reads that Readyset handles: when they hit the cache, when results refresh, and how replication is progressing.&lt;/p&gt;

&lt;p&gt;We brought that view into Percona Monitoring and Management (PMM) through its &lt;a href="https://docs.percona.com/percona-monitoring-and-management/3/install-pmm/install-pmm-client/connect-database/external.html" rel="noopener noreferrer"&gt;external-service support&lt;/a&gt;. Readyset already has Grafana dashboards in its repository, so we could start with those and watch them fill with data. Here's how to connect the two in your own PMM installation.&lt;/p&gt;

&lt;p&gt;PMM can monitor Readyset by adding it as an external service and importing Readyset's Grafana dashboards. In this blog we will walkthrough how to do it using Readyset 1.32.0 from the &lt;a href="https://github.com/readysettech/readyset/releases/tag/stable-261022" rel="noopener noreferrer"&gt;official stable GitHub release&lt;/a&gt; and PMM 3.10.0. We tested MySQL 8.4.13 and PostgreSQL 16.15 separately on AWS, with one Readyset deployment in each run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connect Readyset to PMM
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Prometheus metrics are enabled by default.&lt;/strong&gt; By default Readyset listens on &lt;code&gt;0.0.0.0:6034&lt;/code&gt;, exposing port 6034 on all IPv4 interfaces. We recommend restricting access to the metrics port to your monitoring network if you're not behind a private network by configuring &lt;code&gt;PROMETHEUS_METRICS&lt;/code&gt; or &lt;code&gt;METRICS_ADDRESS&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For a package installation, install PMM Client on the Readyset server and register it with your running PMM Server using Percona's &lt;a href="https://docs.percona.com/percona-monitoring-and-management/3/install-pmm/install-pmm-client/package_manager.html" rel="noopener noreferrer"&gt;PMM Client installation and registration guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Once PMM Client is registered, add Readyset as an external service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pmm-admin add external \
  --service-name=readyset-cache \
  --listen-port=6034 \
  --metrics-path=/metrics \
  --scheme=http \
  --metrics-mode=push \
  --group=readyset \
  --skip-connection-check

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A successful registration reports:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;External Service added.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The service appears as &lt;code&gt;readyset-cache&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;PMM's &lt;code&gt;--metrics-mode=push&lt;/code&gt; controls delivery of monitoring data to PMM Server, regardless of the Readyset cache type.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you import the Readyset dashboards into PMM?
&lt;/h2&gt;

&lt;p&gt;With &lt;a href="https://readyset.io/docs/cache/cache" rel="noopener noreferrer"&gt;push-based caching&lt;/a&gt;, Readyset updates cached results from the database replication stream. Pull-based caching refreshes results by querying the database according to the cache policy. Download the corresponding dashboards from the &lt;a href="https://github.com/readysettech/readyset/tree/stable-261022/build/docker/grafana/dashboards" rel="noopener noreferrer"&gt;Readyset repository at the tested release&lt;/a&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dashboard&lt;/th&gt;
&lt;th&gt;File&lt;/th&gt;
&lt;th&gt;Use it for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pull-based Caching&lt;/td&gt;
&lt;td&gt;&lt;a href="https://raw.githubusercontent.com/readysettech/readyset/stable-261022/build/docker/grafana/dashboards/shallow_caching.json" rel="noopener noreferrer"&gt;&lt;code&gt;shallow_caching.json&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Cache hits, misses, and refresh activity.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replication Performance&lt;/td&gt;
&lt;td&gt;&lt;a href="https://raw.githubusercontent.com/readysettech/readyset/stable-261022/build/docker/grafana/dashboards/replication_performance.json" rel="noopener noreferrer"&gt;&lt;code&gt;replication_performance.json&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;The replication path used by push-based caching.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The repository retains the filename &lt;code&gt;shallow_caching.json&lt;/code&gt;. Name that dashboard Pull-based Caching during import.&lt;/p&gt;

&lt;p&gt;If PMM monitors several Readyset deployments, the Replication Performance dashboard needs changes before you can use it to inspect one deployment. It has no deployment selector, and its unmodified queries do not isolate a deployment. The Pull-based Caching dashboard does have that selector.&lt;/p&gt;

&lt;p&gt;Both dashboards use PMM's &lt;strong&gt;Metrics&lt;/strong&gt; data source. With the JSON file downloaded, we can turn those metrics into a dashboard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open the import page.&lt;/strong&gt; In PMM, choose &lt;strong&gt;All dashboards&lt;/strong&gt; , open &lt;strong&gt;New&lt;/strong&gt; , and click &lt;strong&gt;Import&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbvxh731hdnr5d58bsb4h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbvxh731hdnr5d58bsb4h.png" alt="Follow the highlights: 1. All dashboards, 2. New, 3. Import" width="799" height="253"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Follow the highlights: 1. All dashboards, 2. New, 3. Import.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Load the dashboard definition.&lt;/strong&gt; Open the downloaded JSON file and copy its contents. Paste them under &lt;strong&gt;Import via dashboard JSON model&lt;/strong&gt; , then click the &lt;strong&gt;Load&lt;/strong&gt; button directly beneath that field.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzrffpw1swk5ws6taueyj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzrffpw1swk5ws6taueyj.png" alt="Paste the dashboard JSON, then click Load beneath the JSON field" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1. Paste the dashboard JSON. 2. Click Load beneath the JSON field.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connect the dashboard to your metrics.&lt;/strong&gt; For the pull-based dashboard, set the name to Pull-based Caching. Select &lt;strong&gt;Metrics&lt;/strong&gt; for the &lt;code&gt;DS_PROMETHEUS&lt;/code&gt; input, then click &lt;strong&gt;Import&lt;/strong&gt;. Repeat the process with the Replication Performance JSON file, keeping its dashboard name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcraht9es1xvtlghhpi67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcraht9es1xvtlghhpi67.png" alt="Set the dashboard name, choose Metrics, then click Import" width="799" height="578"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;1. Set the dashboard name. 2. Choose Metrics. 3. Click Import.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For Pull-based Caching, select your Readyset deployment, leave &lt;strong&gt;Query Filter&lt;/strong&gt; set to &lt;strong&gt;All&lt;/strong&gt; , and choose a time range covering your application's activity. &lt;strong&gt;Last 15 minutes&lt;/strong&gt; covered our test queries.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu2hrvtywhbls1fvh4vzu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu2hrvtywhbls1fvh4vzu.jpg" alt="The existing repository dashboard, imported into PMM and populated by live queries" width="749" height="756"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The existing repository dashboard, imported into PMM and populated by live queries. Only the display name and data-source mapping were changed.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Validate Readyset Performance with Percona PMM
&lt;/h2&gt;

&lt;p&gt;With the dashboard open, we ran reads through Readyset and saw cache hits, misses, and refresh activity appear. Across the MySQL and PostgreSQL runs, all 27 dashboard expressions executed successfully; 25 returned series in each run.&lt;/p&gt;

&lt;p&gt;The connection also stayed registered after restarting PMM Client: the service and agent identifiers were retained, and fresh metrics arrived afterward.&lt;/p&gt;

&lt;p&gt;If you follow until here, now it's your turn. Try it with a query you know. Choose a read whose results can tolerate some delay after an update, cache it in a test environment using the &lt;a href="https://readyset.io/docs/cache/cache" rel="noopener noreferrer"&gt;Readyset cache guide&lt;/a&gt;, and run it repeatedly while watching the dashboard. Keep the database's PMM monitoring open too. We found this a useful starting point for following the work Readyset serves alongside the work that still reaches the database.&lt;/p&gt;

&lt;p&gt;Feedback is welcome. If you need a dashboard that isn't covered here, tell us what you'd like to monitor by opening an issue at &lt;a href="https://github.com/readysettech/readyset" rel="noopener noreferrer"&gt;Readyset github&lt;/a&gt;. We're happy to add it.&lt;/p&gt;

</description>
      <category>tutorials</category>
      <category>mysql</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Readyset vs Redis for SQL Query Caching</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Mon, 16 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/readyset-vs-redis-for-sql-query-caching-4m99</link>
      <guid>https://dev.to/readyset/readyset-vs-redis-for-sql-query-caching-4m99</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnev1ib5ih7h6baq5m1on.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnev1ib5ih7h6baq5m1on.png" alt="Readyset vs Redis for SQL Query Caching" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Redis is a fast in-memory data store, so using it as a query cache means the application owns the cache keys, serialization, TTLs, and invalidation. Readyset is a &lt;a href="https://readyset.io/blog/what-is-a-wire-compatible-sql-caching-proxy" rel="noopener noreferrer"&gt;wire-compatible SQL caching proxy&lt;/a&gt; for PostgreSQL and MySQL: its pull-based cache stores query results behind the database connection, so the application keeps sending plain SQL. Readyset replaces Redis only as a SQL query result cache; Redis keeps everything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Redis good at?
&lt;/h2&gt;

&lt;p&gt;Redis is a data structure server. It keeps strings, hashes, JSON documents, sets, sorted sets, streams and other types in memory, and it serves reads from memory in under a millisecond.&lt;/p&gt;

&lt;p&gt;Redis does many jobs besides caching: session storage with expiry, rate limiting, leaderboards built on sorted sets, job queues, pub/sub messaging and event streams.&lt;/p&gt;

&lt;p&gt;Redis also has a broad ecosystem. Client libraries cover most major languages, and frameworks such as Spring and Django include Redis-backed caching. For data the database does not own, such as API responses, rendered fragments and computed values, Redis is the natural cache.&lt;/p&gt;

&lt;p&gt;Caching SQL query results is a narrower job than the rest of what Redis does, and it is a job where Redis asks a lot of the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changes when you use Redis as a query cache?
&lt;/h2&gt;

&lt;p&gt;Using Redis as a SQL query cache is application-level caching. Redis documents the pattern as cache-aside: the application reads Redis first, falls back to the database on a miss, writes the result back to Redis, and on every update writes the database and then invalidates the cache key.&lt;/p&gt;

&lt;p&gt;Most steps of cache-aside are application code and application policy. The application designs a key for each query and its parameters, serializes the result set into a Redis value and back, and chooses a TTL for each kind of data. The Redis server needs an eviction policy such as &lt;code&gt;allkeys-lru&lt;/code&gt; for when it reaches its &lt;code&gt;maxmemory&lt;/code&gt; limit.&lt;/p&gt;

&lt;p&gt;Cache invalidation is the hardest part. On every write, the application must find every cached result the write affects, including joins and aggregates that read other tables, and delete or rewrite them. In &lt;a href="https://readyset.io/blog/cache-invalidation-sql-queries" rel="noopener noreferrer"&gt;our invalidation experiment&lt;/a&gt;, six read paths served the same story page on a MySQL database under identical writes: the database directly, two Redis look-aside caches, two Readyset pull-based caches and a Readyset push-based cache. A plausible set of per-table rules for Redis never converged to correct results after an author rename, because the cached pages that joined the renamed table were never invalidated.&lt;/p&gt;

&lt;p&gt;Cache stampede is the second hardest part. When a popular key expires under high concurrency, many processes query the database for the same record at once. Redis documents Lua scripting for mutex locks or probabilistic early refresh as the defense, and the application carries that code.&lt;/p&gt;

&lt;p&gt;Frameworks reduce the boilerplate, but the invalidation policy still lives in the application. A change data capture (CDC) pipeline such as Redis Data Integration or Debezium can keep Redis current from the database instead. It is a pipeline to build and run, it holds table records as hashes or JSON documents, and the whole working set must fit in memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  How is Readyset different from Redis?
&lt;/h2&gt;

&lt;p&gt;Readyset is a &lt;a href="https://readyset.io/blog/what-is-a-wire-compatible-sql-caching-proxy" rel="noopener noreferrer"&gt;wire-compatible SQL caching proxy&lt;/a&gt; for PostgreSQL and MySQL. The application connects to Readyset with its existing driver, Readyset answers the queries that have a cache, and Readyset proxies every other query to the database.&lt;/p&gt;

&lt;p&gt;Readyset's &lt;a href="https://readyset.io/docs/concepts/shallow-caching" rel="noopener noreferrer"&gt;pull-based cache&lt;/a&gt; is the counterpart to a Redis query cache. A pull-based cache stores a query's result set in Readyset's memory for a time-to-live (TTL) and refreshes it from the database in the background. &lt;code&gt;CREATE SHALLOW CACHE&lt;/code&gt; creates a pull-based cache, for example &lt;code&gt;CREATE SHALLOW CACHE WITH (POLICY TTL 60 SECONDS REFRESH 10 SECONDS) FROM&lt;/code&gt; followed by the query. Pull-based caches accept almost any read query and need no replication stream.&lt;/p&gt;

&lt;p&gt;Readyset builds cache keys without application code. Readyset turns the literal values in a query into parameters, so queries that differ only in their values share one cache, with a separate entry for each parameter set.&lt;/p&gt;

&lt;p&gt;Readyset also handles refresh and stampedes. With &lt;code&gt;REFRESH&lt;/code&gt;, a read that finds an older entry gets the cached result immediately while Readyset refreshes it in the background. With &lt;code&gt;COALESCE&lt;/code&gt;, concurrent requests for the same missing result share one query to the database. With &lt;a href="https://readyset.io/blog/adaptive-cache" rel="noopener noreferrer"&gt;&lt;code&gt;ADAPTIVE&lt;/code&gt;&lt;/a&gt;, Readyset shortens the refresh interval of a result that keeps changing and lengthens it for one that does not.&lt;/p&gt;

&lt;p&gt;Readyset sizes its pull-based store as a share of its memory limit. When the store is full, Readyset keeps the results that save the most database time, weighing how often each is requested against how long its query takes, and it serves result sets above a configured size from the database without caching them.&lt;/p&gt;

&lt;p&gt;Readyset is a Redis cache alternative for SQL query results on MySQL and PostgreSQL, and not for sessions, queues or other data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Readyset vs Redis at a glance
&lt;/h2&gt;

&lt;p&gt;Redis is a general-purpose data store used here as a query cache, while Readyset is a SQL proxy built to cache query results.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Redis as a query cache&lt;/th&gt;
&lt;th&gt;Readyset pull-based cache&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Application code&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The application reads, writes and invalidates cache entries&lt;/td&gt;
&lt;td&gt;The application sends SQL, and Readyset caches selected queries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SQL awareness and key design&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The application builds a key for every query and parameter set and serializes results&lt;/td&gt;
&lt;td&gt;Readyset parameterizes queries automatically and stores result sets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cache invalidation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The application deletes or rewrites keys on every write&lt;/td&gt;
&lt;td&gt;Readyset has no invalidation step: freshness comes from the TTL and refresh settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stampede protection&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Application-side locks or early refresh&lt;/td&gt;
&lt;td&gt;Readyset refreshes in the background and coalesces concurrent misses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Eviction and memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The Redis server needs &lt;code&gt;maxmemory&lt;/code&gt; and an eviction policy configured&lt;/td&gt;
&lt;td&gt;Readyset uses a share of its memory limit with cost-aware admission&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Infrastructure&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A Redis service to deploy, size and monitor&lt;/td&gt;
&lt;td&gt;A Readyset service in front of the database to deploy, size and monitor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Write handling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The application writes the database and updates the cache&lt;/td&gt;
&lt;td&gt;Writes pass through Readyset to the database unchanged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What a cache hit and a miss cost&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One round trip to Redis on a hit. On a miss, a Redis lookup, a database query, and a write back to Redis that the application issues&lt;/td&gt;
&lt;td&gt;One round trip to Readyset on a hit. On a miss, still one round trip from the application, with Readyset querying the database&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What are the alternatives to a Redis cache for SQL queries?
&lt;/h2&gt;

&lt;p&gt;Alternatives to a Redis query cache differ in who does the work of keeping results correct.&lt;/p&gt;

&lt;p&gt;Another in-memory key-value cache used as a query cache follows the same cache-aside pattern, so the application still owns the keys, serialization and invalidation.&lt;/p&gt;

&lt;p&gt;Read replicas add capacity by running every query against a copy of the database. They spread the work without removing it, and each replica is a full copy of the data to run and pay for.&lt;/p&gt;

&lt;p&gt;Materialized views, in databases that support them, store a query result and refresh it on a schedule or on demand, so the result is only as current as the last refresh.&lt;/p&gt;

&lt;p&gt;A SQL caching proxy moves the cache behind the database connection. Readyset's pull-based cache is a Redis cache alternative for SQL query results that serves them from memory for a TTL, and its &lt;a href="https://readyset.io/docs/concepts/deep-caching" rel="noopener noreferrer"&gt;push-based cache&lt;/a&gt; keeps results current by following the database's replication stream.&lt;/p&gt;

&lt;h2&gt;
  
  
  How fresh are cached results in Redis and in Readyset?
&lt;/h2&gt;

&lt;p&gt;Redis can be fresher than a TTL cache when the application deletes a key at the moment it writes. Redis does not do this on its own: a key that no write path invalidates stays stale until its TTL expires or it is evicted. In &lt;a href="https://readyset.io/blog/cache-invalidation-sql-queries" rel="noopener noreferrer"&gt;our invalidation experiment&lt;/a&gt;, which timed how long after a MySQL write a reader first saw the new value, a correctly invalidated Redis look-aside cache was fresh to within about a millisecond, while a Readyset pull-based cache with a 10-second TTL and a 5-second refresh lagged by seconds. Each write to the Redis look-aside cache was also followed by a burst of identical queries to the database as readers refilled the key.&lt;/p&gt;

&lt;p&gt;A Readyset pull-based cache has no invalidation step, so its results are as old as the refresh interval and TTL allow. An entry that is read continuously stays no more than about one refresh interval behind the database, and an entry nobody reads for a full TTL is dropped.&lt;/p&gt;

&lt;p&gt;A Readyset &lt;a href="https://readyset.io/docs/concepts/deep-caching" rel="noopener noreferrer"&gt;push-based cache&lt;/a&gt; stays current by following the MySQL binlog or the PostgreSQL write-ahead log (WAL) and not by refreshing on an interval, and it is eventually consistent. A query that must reflect a write immediately is a candidate for a push-based cache, or it can stay uncached so that Readyset proxies it to the database.&lt;/p&gt;

&lt;p&gt;Readyset also provides &lt;a href="https://readyset.io/docs/concepts/read-your-writes" rel="noopener noreferrer"&gt;read-your-writes controls&lt;/a&gt;: a transaction policy on each cache for reads inside a transaction, and an optional window that sends a session's reads to the database for a set time after the session writes.&lt;/p&gt;

&lt;h2&gt;
  
  
  When is Redis the better choice for caching?
&lt;/h2&gt;

&lt;p&gt;Redis is the better choice when the data is not a SQL query result. Redis caches anything the application can serialize, including API responses, rendered fragments and computed values, and Readyset caches only the results of &lt;code&gt;SELECT&lt;/code&gt; queries.&lt;/p&gt;

&lt;p&gt;Redis is also the better choice when the application needs control or reach that Readyset does not offer. Redis does not depend on the source of the data, because the application decides what goes into it, so it can cache results from any datastore or from none. Readyset supports PostgreSQL and MySQL. Redis lets the application set a TTL per key and delete a key immediately on a write, while a Readyset pull-based cache is bounded by its TTL and refresh settings.&lt;/p&gt;

&lt;p&gt;Redis costs less infrastructure to add when it is already running. A team with Redis in production for sessions and queues can add a cache to that instance without deploying another service, while Readyset is a new service to deploy and size.&lt;/p&gt;

&lt;p&gt;Readyset has limits of its own. A pull-based cache holds results in memory and runs the query on the database at every refresh, so an aggressive refresh on a high-cardinality cache can raise database load. Readyset does not cache locking reads such as &lt;code&gt;SELECT ... FOR UPDATE&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do you still need Redis if you run Readyset?
&lt;/h2&gt;

&lt;p&gt;Yes, for everything that is not a SQL query result. Sessions, rate limiting, leaderboards, pub/sub, streams and application-computed data stay on Redis.&lt;/p&gt;

&lt;p&gt;Job queues are the clearest example of Redis work that is not caching. Frameworks such as Laravel offer Redis as a queue backend for background jobs, and a job queue is a different feature from caching, one that Readyset does not touch. A team whose framework uses Redis for queues keeps Redis whether or not it moves its query cache.&lt;/p&gt;

&lt;p&gt;Readyset and Redis run side by side. As a Redis cache alternative, Readyset takes SQL query result caching, and Redis keeps every other job.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does moving a Redis query cache to Readyset involve?
&lt;/h2&gt;

&lt;p&gt;Start by pointing a staging copy of the application at Readyset by changing the connection string. Readyset proxies every query, and &lt;code&gt;SHOW PROXIED QUERIES&lt;/code&gt; lists them with a &lt;code&gt;readyset_supported&lt;/code&gt; column that says whether each one can be cached.&lt;/p&gt;

&lt;p&gt;Then create a pull-based cache for the queries you want, one at a time, and set the TTL and refresh interval from what each query's data tolerates. A query whose results must reflect writes immediately can use a push-based cache or stay uncached.&lt;/p&gt;

&lt;p&gt;Pull-based cache entries are keyed on the query and its parameters, so cache only queries whose results are safe for every client that connects to Readyset. Pull-based caches support Postgres row-level security by keying on the session state its policies read. Automatic caching rejects queries that reference session or user variables, and a cache created explicitly is cached as written.&lt;/p&gt;

&lt;p&gt;Check the first caches against the database before moving more queries. The &lt;a href="https://readyset.io/docs/concepts/query-support" rel="noopener noreferrer"&gt;query support page&lt;/a&gt; lists what each cache type accepts on MySQL and PostgreSQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which should you use for SQL query caching?
&lt;/h2&gt;

&lt;p&gt;We see Redis and Readyset as tools for different jobs, and what separates them is who owns the cache. Our recommendation is to keep Redis for sessions, queues, rate limits and application data, and to use Readyset's pull-based cache for SQL query results. Look at &lt;code&gt;SHOW PROXIED QUERIES&lt;/code&gt; first and cache the queries that repeat most.&lt;/p&gt;

&lt;p&gt;To go through your own PostgreSQL or MySQL workload with the Readyset team, &lt;a href="https://readyset.io/book-a-demo" rel="noopener noreferrer"&gt;book a Readyset demo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>databasecaching</category>
      <category>mysql</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Readyset vs Read Replicas: Which Should You Use to Scale Reads?</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Thu, 12 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/readyset-vs-read-replicas-which-should-you-use-to-scale-reads-4kja</link>
      <guid>https://dev.to/readyset/readyset-vs-read-replicas-which-should-you-use-to-scale-reads-4kja</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft6gkqpdiwldiesbmfdwo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft6gkqpdiwldiesbmfdwo.png" alt="Readyset vs Read Replicas: Which Should You Use to Scale Reads?" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A read replica scales reads by keeping a full copy of your MySQL or Postgres database and executing every query against it. Readyset scales reads by caching query results and keeping them fresh from the same replication stream, so a repeated query is looked up instead of executed. Replicas add capacity. Readyset removes work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does a read replica actually do?
&lt;/h2&gt;

&lt;p&gt;A read replica is a second database server that holds a full copy of the primary and answers reads. The primary records every change in its replication log, the binary log (binlog) in MySQL and the write-ahead log (WAL) in Postgres, and the read replica replays that log so its tables follow the primary's.&lt;/p&gt;

&lt;p&gt;A read replica executes every query it receives. Prepared statements can skip parsing, and Postgres can reuse a cached plan, but the execution itself (the index lookups, joins, sorts and aggregation) runs again against the replica's own tables and buffer pool, even when the identical query finished a millisecond earlier. A replica adds a server's worth of capacity for that work without shortening it, so an aggregate that is slow on the primary still pays the same execution cost on a replica of the same size.&lt;/p&gt;

&lt;p&gt;A read replica also repeats every write. A MySQL replica applies the same row changes the primary made, secondary indexes included, and a Postgres standby replays the WAL for every changed table and index page, so either one needs enough I/O to keep pace with the primary's write rate before it serves a single read.&lt;/p&gt;

&lt;p&gt;A read replica needs storage for the full dataset, and usually as much memory as the primary, because it serves the same working set. Infrastructure cost grows linearly with every replica added, and we lay out that arithmetic in &lt;a href="https://readyset.io/blog/why-query-caching-is-the-most-cost-effective-way-to-scale-databases-and-everyones-missing-it" rel="noopener noreferrer"&gt;why query caching is the most cost-effective way to scale databases&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does Readyset do instead?
&lt;/h2&gt;

&lt;p&gt;Readyset is a wire-compatible SQL caching proxy for PostgreSQL and MySQL. The application keeps its driver and its SQL, and the only required change is the connection string, which points at Readyset instead of the database. Readyset answers the queries that have a cache and proxies everything else to the database, including every write and every locking read such as &lt;code&gt;SELECT ... FOR UPDATE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Caching in Readyset is chosen per query: &lt;code&gt;CREATE DEEP CACHE FROM&lt;/code&gt; followed by the query creates a push-based cache for it, and &lt;code&gt;CREATE SHALLOW CACHE FROM&lt;/code&gt; creates a pull-based one. Readyset turns the literal values in a query into parameters, so &lt;code&gt;customer_id = 7&lt;/code&gt; and &lt;code&gt;customer_id = 9&lt;/code&gt; share one cache and become two keys in it.&lt;/p&gt;

&lt;p&gt;A Readyset &lt;a href="https://readyset.io/docs/concepts/deep-caching" rel="noopener noreferrer"&gt;push-based cache&lt;/a&gt; stays fresh from the same change log a read replica uses. Readyset first snapshots the upstream tables, full rows, into RocksDB on its own local disk. It then follows the MySQL binlog in row format, or a logical replication slot it creates on the Postgres database.&lt;/p&gt;

&lt;p&gt;Push-based caching needs Readyset started with &lt;code&gt;CACHE_MODE=deep&lt;/code&gt; or &lt;code&gt;deep-then-shallow&lt;/code&gt;, because the default mode, shallow, runs no replication at all.&lt;/p&gt;

&lt;p&gt;Readyset keeps each push-based cache current with incremental view maintenance: when a row changes upstream, Readyset applies only the resulting delta to the cached results that row affects, instead of re-running the query. Readyset's dataflow engine derives from &lt;a href="https://www.usenix.org/conference/osdi18/presentation/gjengset" rel="noopener noreferrer"&gt;Noria&lt;/a&gt;, a research project at MIT's Computer Science and Artificial Intelligence Laboratory (CSAIL), published at the 2018 USENIX Symposium on Operating Systems Design and Implementation (OSDI).&lt;/p&gt;

&lt;p&gt;Readyset uses partial materialization, so a push-based cache holds results only for the parameter values the application has asked for. The first read of a new value is a miss: Readyset computes that one key from its own copy of the tables, in what the documentation calls an &lt;a href="https://readyset.io/docs/concepts/efficiency" rel="noopener noreferrer"&gt;upquery&lt;/a&gt;, then stores and returns it.&lt;/p&gt;

&lt;p&gt;Later reads of that key are in-memory lookups in Readyset, typically under a millisecond, served by lock-free readers that never wait on replication. A change to a customer nobody has read updates Readyset's copy of the table and stops at the first step of the graph that holds no state for that customer.&lt;/p&gt;

&lt;p&gt;Readyset caps its memory with &lt;code&gt;--memory-limit&lt;/code&gt;. When memory reaches that limit, Readyset evicts the least recently used keys, and an evicted key is computed again on its next read.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F5c9baa58-0091-4d7f-8fe0-31e8a0beba12.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F5c9baa58-0091-4d7f-8fe0-31e8a0beba12.gif" alt="Four identical queries arrive. A read replica executes all four, while Readyset computes customer 7 and customer 9 once each and answers the two repeats from memory" width="760" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The same query, four times. The read replica executes all four. Readyset computes customer 7 and customer 9 once each and answers the two repeats from memory.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Readyset also offers &lt;a href="https://readyset.io/docs/concepts/shallow-caching" rel="noopener noreferrer"&gt;pull-based caches&lt;/a&gt;. A pull-based cache stores a query's result for a time-to-live (TTL) and refreshes it from the database in the background, for example &lt;code&gt;CREATE SHALLOW CACHE WITH (POLICY TTL 60 SECONDS REFRESH 10 SECONDS) FROM&lt;/code&gt; followed by the query. With &lt;code&gt;REFRESH&lt;/code&gt;, a read that finds an entry older than 10 seconds gets the cached result and starts a refresh; &lt;code&gt;REFRESH EVERY&lt;/code&gt; refreshes on a fixed schedule instead.&lt;/p&gt;

&lt;p&gt;Pull-based caches need no replication stream and accept almost any read query. Their freshness comes from the refresh settings and the TTL rather than from writes: an entry read continuously stays roughly one refresh interval behind, and an entry nobody reads for a full TTL is dropped.&lt;/p&gt;

&lt;p&gt;Where a plain TTL cache refreshes every key on one schedule, Readyset can adapt the refresh interval to each result. With the &lt;code&gt;ADAPTIVE&lt;/code&gt; option, Readyset shortens the interval for a result that changed at its last refresh and lengthens it for one that didn't, between 10% and 100% of the configured interval, and caps the extra load those refreshes send to the database. Caches that Readyset creates automatically are always adaptive.&lt;/p&gt;

&lt;p&gt;In our &lt;a href="https://readyset.io/blog/adaptive-cache" rel="noopener noreferrer"&gt;benchmark&lt;/a&gt;, adaptive refresh cut p95 staleness by 86% compared with a fixed refresh schedule.&lt;/p&gt;

&lt;h2&gt;
  
  
  Readyset vs read replicas at a glance
&lt;/h2&gt;

&lt;p&gt;A read replica stores and queries a full copy of the data, while Readyset serves precomputed query results from memory.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Read replica&lt;/th&gt;
&lt;th&gt;Readyset&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What gets copied&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The whole database, from the primary's binlog (MySQL) or WAL (Postgres)&lt;/td&gt;
&lt;td&gt;Push-based caches: the replicated tables on local disk, from the same binlog or WAL, plus cached results in memory. Pull-based caches copy no tables&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What runs per read&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A full execution against the base tables, plus parse and plan unless a prepared statement reuses them&lt;/td&gt;
&lt;td&gt;Push-based caches: a key lookup, or a computation from Readyset's own copy on a miss. Pull-based caches: a lookup, with misses and refreshes run on the database. Uncached queries go to the primary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What runs per write&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The same row change (MySQL) or WAL page changes (Postgres), indexes included&lt;/td&gt;
&lt;td&gt;The change as a delta through each push-based cache that reads the table&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;How freshness is maintained&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Asynchronous replay of the binlog or WAL&lt;/td&gt;
&lt;td&gt;Push-based caches: incremental view maintenance from the binlog or WAL. Pull-based caches: background refresh from the database&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Application changes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Reads routed to the replica endpoint, writes to the primary&lt;/td&gt;
&lt;td&gt;Connection string pointed at Readyset; you choose which queries to cache&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;How cost scales&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Each replica adds a full copy's storage, memory and compute&lt;/td&gt;
&lt;td&gt;Memory follows the cached results and the operator state behind them, with eviction at a configured limit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Failover&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A replica can be promoted to primary&lt;/td&gt;
&lt;td&gt;None: the primary and its replicas remain the availability layer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SQL coverage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Every read query the engine supports&lt;/td&gt;
&lt;td&gt;Push-based caches: a defined subset of &lt;code&gt;SELECT&lt;/code&gt;. Pull-based caches: almost any read. Anything else is proxied&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Consistency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Asynchronous lag, with the primary's engine semantics&lt;/td&gt;
&lt;td&gt;Push-based caches: eventually consistent. Pull-based caches: as stale as the refresh interval and TTL allow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Does Readyset replace a read replica?
&lt;/h2&gt;

&lt;p&gt;For read scaling, Readyset can replace read replicas for the queries it caches, because Readyset answers a cached query from memory and that read never reaches the primary or any read replica.&lt;/p&gt;

&lt;p&gt;Readyset does not replace the other jobs of a read replica. Readyset proxies uncached and unsupported queries to the primary and has no failover role, so the primary still needs read replicas or another high-availability mechanism.&lt;/p&gt;

&lt;p&gt;Readyset's two cache types replace different things. Readyset push-based caching, which maintains results from the binlog or WAL, is the alternative to adding read replicas. Readyset pull-based caching is the alternative to an application-managed key-value cache such as Redis, without the invalidation code that goes with it.&lt;/p&gt;

&lt;p&gt;Teams use Readyset to delay adding read replicas or to run a smaller database tier, while keeping the replicas that availability requires. The cost argument is in &lt;a href="https://readyset.io/blog/real-cost-of-read-replicas" rel="noopener noreferrer"&gt;The Real Cost of Read Replicas&lt;/a&gt; and &lt;a href="https://readyset.io/blog/why-query-caching-is-the-most-cost-effective-way-to-scale-databases-and-everyones-missing-it" rel="noopener noreferrer"&gt;why query caching is the most cost-effective way to scale databases&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When is a read replica the better choice?
&lt;/h2&gt;

&lt;p&gt;A read replica is the better choice when the requirement is availability, complete SQL coverage, tighter read consistency, or reads from another region.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Availability.&lt;/strong&gt; A read replica can be promoted to primary when the primary fails, and Readyset cannot. After a failover, Readyset is &lt;a href="https://readyset.io/docs/reference/failover" rel="noopener noreferrer"&gt;repointed to the new primary&lt;/a&gt;: on MySQL with GTIDs it resumes from the last transaction it applied, without a new snapshot, and on Postgres it creates a new replication slot and takes a full snapshot again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQL coverage.&lt;/strong&gt; A replica runs any query the engine supports. Readyset push-based caches support a defined subset of &lt;code&gt;SELECT&lt;/code&gt;: a query that combines results with &lt;code&gt;UNION&lt;/code&gt;, &lt;code&gt;INTERSECT&lt;/code&gt; or &lt;code&gt;EXCEPT&lt;/code&gt;, or walks a hierarchy with a recursive common table expression (CTE), cannot have a push-based cache on MySQL or Postgres. A pull-based cache accepts those queries, and anything without a cache is proxied to the primary. The &lt;a href="https://readyset.io/docs/concepts/query-support" rel="noopener noreferrer"&gt;query support page&lt;/a&gt; lists each shape for both engines and both cache types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consistency.&lt;/strong&gt; A read replica can tighten read-after-write behavior at the cost of write latency, and the two engines do it differently. Postgres can make a commit wait until a synchronous standby has applied it, with &lt;a href="https://www.postgresql.org/docs/current/runtime-config-wal.html" rel="noopener noreferrer"&gt;&lt;code&gt;synchronous_commit = remote_apply&lt;/code&gt;&lt;/a&gt;, so a read that starts on that standby afterwards sees the write. MySQL &lt;a href="https://dev.mysql.com/doc/refman/8.4/en/replication-semisync.html" rel="noopener noreferrer"&gt;semi-synchronous replication&lt;/a&gt; waits only until a replica has received the transaction, so it protects durability without making the replica's reads current.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Location and reporting.&lt;/strong&gt; A read replica can sit in another region near users, and suits long-running reporting and extract, transform, load (ETL) queries that need no cache.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workload shape.&lt;/strong&gt; Readyset saves little on queries that rarely repeat with the same parameters, or on primary-key lookups the database already answers in about a millisecond. Our &lt;a href="https://readyset.io/blog/readyset-azure-postgres-gitlab-field-test" rel="noopener noreferrer"&gt;GitLab field test on Azure Postgres&lt;/a&gt;, which used pull-based caches, showed the same pattern: its heaviest queries ran 5.7x to 26.3x faster at the median, while per-query latency on primary-key lookups came out roughly even.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about replication lag and consistency?
&lt;/h2&gt;

&lt;p&gt;Read replicas and Readyset both follow the primary asynchronously, so either can return data slightly older than the primary.&lt;/p&gt;

&lt;p&gt;Under heavy write load, a read replica's lag can grow from milliseconds to seconds, and every read from that replica sees it.&lt;/p&gt;

&lt;p&gt;A Readyset push-based cache is &lt;a href="https://readyset.io/docs/concepts/deep-caching" rel="noopener noreferrer"&gt;eventually consistent&lt;/a&gt;. Its lag is the time for a change to arrive through the binlog or WAL and for its delta to reach the reader, and it applies only to cached queries, because Readyset proxies uncached queries to the primary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbjecs1feki1dl57iskay.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbjecs1feki1dl57iskay.gif" alt="One INSERT reaches both systems. The read replica writes the row and recomputes on the next read, while Readyset updates only the one stored count the row affects" width="799" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;One INSERT reaching both. The replica writes the row and recomputes on the next read; Readyset updates the one stored count the row affects.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Readyset provides two controls for reading your own writes (RYW). Inside a transaction, each cache has a transaction policy: by default Readyset proxies the cached query to the primary for the whole transaction, &lt;code&gt;UNTIL WRITE&lt;/code&gt; serves the cache until the transaction writes, and &lt;code&gt;ALWAYS&lt;/code&gt; always serves the cache. Outside a transaction, an &lt;a href="https://readyset.io/docs/concepts/read-your-writes" rel="noopener noreferrer"&gt;opportunistic window&lt;/a&gt;, off by default, sends a session's reads to the primary for a set number of milliseconds after the session writes. The window narrows the race and is not a guarantee.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can you run Readyset and read replicas together?
&lt;/h2&gt;

&lt;p&gt;Yes. Readyset and read replicas run together because they do different jobs.&lt;/p&gt;

&lt;p&gt;The application sends the queries it wants cached through Readyset, and Readyset connects to the primary. Readyset answers cached queries from memory and proxies every other query to the primary, while read replicas keep the roles Readyset does not fill: failover, reporting and analytics, and reads from another region.&lt;/p&gt;

&lt;p&gt;By default, Readyset reads the binlog in MySQL or the WAL in Postgres from the primary. On MySQL, Readyset can instead follow a read replica that writes its own binlog (&lt;code&gt;log_replica_updates=ON&lt;/code&gt;), which adds that replica's lag to Readyset's. On Postgres, Readyset follows the primary, where it creates its publication and replication slot. When a read replica is promoted after a primary failure, Readyset is repointed to the new primary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F59527325-b737-43c6-8a7e-5d1f26026ba1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F59527325-b737-43c6-8a7e-5d1f26026ba1.gif" alt="Readyset handles the repeated reads while the replicas handle failover and reporting. After a failover, Readyset follows the promoted replica" width="760" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Readyset handles the repeated reads and the replicas handle failover and reports. After a failover, Readyset follows the promoted replica.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you try Readyset on your own queries?
&lt;/h2&gt;

&lt;p&gt;Readyset shows which of your queries it can cache before you cache anything. Point a staging copy of the application at Readyset, run the usual traffic, and &lt;code&gt;SHOW PROXIED QUERIES&lt;/code&gt; lists every query Readyset has passed through, with a &lt;code&gt;readyset_supported&lt;/code&gt; column saying whether each one can be cached.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SHOW PROXIED DEEP QUERIES&lt;/code&gt; and &lt;code&gt;SHOW PROXIED SHALLOW QUERIES&lt;/code&gt; show the same list for push-based and for pull-based caches, so you can see which queries each cache type would take before creating any.&lt;/p&gt;

&lt;h2&gt;
  
  
  Query caching vs read replicas: which should you use?
&lt;/h2&gt;

&lt;p&gt;We see Readyset and read replicas as tools for different parts of read scaling, and what decides between them is how often your reads repeat. Our recommendation is to keep the replicas your failover plan needs, then look at your read traffic before adding more. Put it through Readyset, cache the expensive queries that repeat most, and leave the rest to the replicas: one-off reports, SQL that Readyset doesn't cache, and reads that must see the latest write.&lt;/p&gt;

&lt;p&gt;To go through your own PostgreSQL or MySQL workload with the Readyset team, &lt;a href="https://readyset.io/book-a-demo" rel="noopener noreferrer"&gt;book a Readyset demo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>databasescaling</category>
      <category>mysql</category>
      <category>postgres</category>
    </item>
    <item>
      <title>What Is Database Sharding, and When Should You Shard?</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Tue, 10 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/what-is-database-sharding-and-when-should-you-shard-2oic</link>
      <guid>https://dev.to/readyset/what-is-database-sharding-and-when-should-you-shard-2oic</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw27qd0otzwnulhzz5bem.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw27qd0otzwnulhzz5bem.png" alt="What Is Database Sharding, and When Should You Shard?" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Database sharding splits one logical database across several independent database servers, called shards, so that each server stores and serves only part of the rows. A shard key, such as a customer ID or a tenant ID, decides which shard owns each row, and a routing layer sends every query to the shard that holds its data. Sharding lets a relational database grow beyond the storage, memory, and write capacity of a single machine.&lt;/p&gt;

&lt;p&gt;How to shard is well documented. When to shard is harder, because sharding is close to a one-way door: once rows live on different servers, every cross-shard join and schema change costs more, and undoing it means migrating the data back. We decide with three conditions: the data, the working set, or the write load has outgrown what one server can handle. For MySQL and Postgres, we add a size rule from experience: &lt;em&gt;once a single database heads past 2 to 4 TB, its routine operations, restores in particular, stop fitting inside recovery and change windows, and that is the time to start planning a shard.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is database sharding?
&lt;/h2&gt;

&lt;p&gt;Each shard in a sharded database is a complete database server, with its own storage, buffer pool, replicas, and backups. The shards share a schema and hold different rows. A table of three million customers might keep customers 1 to 1 million on shard A, the next million on shard B, and the rest on shard C, so a query for customer 1,500,042 only ever touches shard B.&lt;/p&gt;

&lt;p&gt;The router is whatever knows that mapping. In many MySQL and Postgres shops, it's the application, which holds a shard map and opens a connection to the right server. It can also be a proxy layer such as &lt;a href="https://vitess.io/" rel="noopener noreferrer"&gt;Vitess&lt;/a&gt; for MySQL, or an extension such as &lt;a href="https://www.citusdata.com/" rel="noopener noreferrer"&gt;Citus&lt;/a&gt; for Postgres, both of which present the shards to the application as a single database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2Fc3697445-1bea-4a84-9374-b82f1bdff841.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2Fc3697445-1bea-4a84-9374-b82f1bdff841.gif" alt="How a sharded database routes a query: the application sends a query for customer 1500042 to the router, which maps it to shard B (customer_id 1M to 2M), the only shard queried, while shards A and C never see it" width="760" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A query that carries the shard key runs on one shard. A query without it runs on every shard, and the router merges the results, a pattern known as scatter/gather.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Sharding gets confused with partitioning and with replication, and the three solve different problems. Partitioning splits a table by a key too, but the partitions all stay on one server and share its disk, memory, and backup. Replication copies every row to more servers, which spreads reads and adds failover targets while leaving each server just as large as before. Only sharding makes each server smaller.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F4fa277f7-8f5a-4668-818a-864d41334bf1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F4fa277f7-8f5a-4668-818a-864d41334bf1.gif" alt="Six rows shown under three strategies: partitioning keeps all six on one server, replication puts all six on each of three servers, and sharding leaves two on each" width="600" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Six rows, three placements. Partitioning keeps all six on one server, replication puts all six on each of three servers, and sharding leaves two on each.&lt;/em&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Partitioning&lt;/th&gt;
&lt;th&gt;Replication&lt;/th&gt;
&lt;th&gt;Sharding&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Where the rows live&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;All on one server&lt;/td&gt;
&lt;td&gt;Full copies on every server&lt;/td&gt;
&lt;td&gt;Different rows on different servers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What it scales&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Maintenance of one large table: pruning scans, dropping old data&lt;/td&gt;
&lt;td&gt;Reads and availability&lt;/td&gt;
&lt;td&gt;Storage, memory, writes and reads&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Who routes queries&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The database engine&lt;/td&gt;
&lt;td&gt;The application or a proxy, to the primary or a replica&lt;/td&gt;
&lt;td&gt;The application, a proxy or an extension, by shard key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Size of each server&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Unchanged&lt;/td&gt;
&lt;td&gt;Unchanged: each replica holds everything&lt;/td&gt;
&lt;td&gt;A fraction of the whole&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Partitioning, replication and sharding compared. Partitioning and replication both leave one server holding the full data set, so neither shortens a backup or a restore.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When should you shard a database?
&lt;/h2&gt;

&lt;p&gt;We recommend sharding a MySQL or Postgres database when at least one of three conditions holds:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The data has outgrown what one server can handle.&lt;/strong&gt; The limit is not what the engine can store but the size at which backups, restores, and schema changes no longer fit your recovery and change windows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The working set is about to outgrow memory.&lt;/strong&gt; The rows and index pages your queries touch every minute no longer fit in the InnoDB buffer pool, or in Postgres shared buffers plus the operating system cache, so reads start going to disk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One primary can't absorb the writes,&lt;/strong&gt; and batching, trimming secondary indexes, and faster storage have stopped helping.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If none of the three holds, sharding adds complexity and buys little. These are the same conditions MongoDB's documentation lists in its &lt;a href="https://www.mongodb.com/docs/manual/core/sharding-distribute-collection-data/" rel="noopener noreferrer"&gt;current manual&lt;/a&gt;, which suggests considering sharding once a collection reaches 3TB, a size range we already see in MySQL and Postgres.&lt;/p&gt;

&lt;p&gt;Each condition shows up in MySQL and Postgres in a recognizable way, and each has cheaper fixes to try first:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Condition&lt;/th&gt;
&lt;th&gt;How it shows up in MySQL and Postgres&lt;/th&gt;
&lt;th&gt;What to try before sharding&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The data outgrows what one server can operate&lt;/td&gt;
&lt;td&gt;Backups, restores, and schema changes outgrow their windows long before the disk fills&lt;/td&gt;
&lt;td&gt;Archive or delete cold rows; partition by time and drop old partitions; compress&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The working set outgrows memory&lt;/td&gt;
&lt;td&gt;The InnoDB buffer pool or Postgres cache hit ratio falls and read I/O climbs with traffic&lt;/td&gt;
&lt;td&gt;A larger instance, better indexes, read replicas, or a cache for the hot reads&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One primary can't absorb the writes&lt;/td&gt;
&lt;td&gt;Writes saturate the primary's CPU or disk, commit latency rises, replicas lag&lt;/td&gt;
&lt;td&gt;Batch writes, drop unused secondary indexes, move to faster storage&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;The three sharding conditions as they show up in MySQL and Postgres. The fixes in the right-hand column buy time; for the write condition they rarely buy much, because one primary still takes every write.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The first condition is about operating the data, not storing it. InnoDB allows a table of up &lt;a href="https://dev.mysql.com/doc/refman/8.4/en/innodb-limits.html" rel="noopener noreferrer"&gt;to 64 TB with the default 16 KB page&lt;/a&gt;, and a Postgres table can reach &lt;a href="https://www.postgresql.org/docs/current/limits.html" rel="noopener noreferrer"&gt;32 TB with the default 8 KB block&lt;/a&gt;. Those are theoretical ceilings, and no one should run a database anywhere near them: performance starts falling apart long before a table gets close. Once the working set outgrows the InnoDB buffer pool, or Postgres shared buffers plus the operating system cache, index lookups and inserts turn into random disk reads. In Postgres, a vacuum pass over a multi-terabyte table can run for hours and fall behind the rate at which the table creates dead rows. The practical limit is the size at which one instance gets too slow to run and too slow to operate, which is what our 2 to 4 TB rule measures.&lt;/p&gt;

&lt;p&gt;Timing matters more than any threshold. Sharding has to start while the database still has headroom, because moving rows onto new shards takes spare I/O and CPU from the very server you're trying to relieve. On MySQL or Postgres, where sharding usually means choosing a key, changing the application, backfilling, and cutting over, the project runs for months. Hence, the decision belongs to the months before the database runs out of capacity, not the week after.&lt;/p&gt;

&lt;p&gt;Sharding costs are why you wait for one of the three conditions. A query that doesn't carry the shard key has to run on every shard, and a scatter/gather query like that is only as fast as the slowest shard. Joins and transactions across shards move into the application or into a distributed transaction protocol. Unique constraints and auto-increment IDs need a scheme that works across servers. Every backup, upgrade, and failover now happens once per shard. The shard key itself is the hardest choice to reverse, so it deserves the most design time before the first row moves.&lt;/p&gt;

&lt;h2&gt;
  
  
  How large can a MySQL or Postgres database get before you shard it?
&lt;/h2&gt;

&lt;p&gt;Our rule of thumb is to start planning a shard once a single MySQL or Postgres database heads past 2 to 4 TB. The range comes from what we've seen in production rather than from a formula, and the restore arithmetic later in this section shows why it lands where it does. The limit has nothing to do with what the engine can store. It comes from how long ordinary operations take once the data is that large: building an index, changing a schema, taking a backup and, above all, restoring one. Treat the range as a starting point; your own number comes from your recovery time objective and a timed restore.&lt;/p&gt;

&lt;p&gt;Index builds and schema changes take longer as tables grow, and their online versions have failure modes that get likelier the longer they run. MySQL's documentation on &lt;a href="https://dev.mysql.com/doc/refman/8.4/en/innodb-online-ddl-limitations.html" rel="noopener noreferrer"&gt;online DDL limitations&lt;/a&gt; says an online data definition language (DDL) operation "must finish running on the source before it is run on the replica", so a six-hour index build on the source becomes roughly six hours of replication lag on every replica. Writes that arrive during the build are buffered in a temporary log capped by &lt;a href="https://dev.mysql.com/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_online_alter_log_max_size" rel="noopener noreferrer"&gt;&lt;code&gt;innodb_online_alter_log_max_size&lt;/code&gt;&lt;/a&gt;, 128 MiB by default, and when that log fills, "the &lt;code&gt;ALTER TABLE&lt;/code&gt; operation fails and all uncommitted concurrent DML operations are rolled back." In Postgres, &lt;a href="https://www.postgresql.org/docs/current/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY" rel="noopener noreferrer"&gt;&lt;code&gt;CREATE INDEX CONCURRENTLY&lt;/code&gt;&lt;/a&gt; "must perform two scans of the table" and wait for every transaction that could use the index, and a failure leaves behind an invalid index that is ignored by queries but "will still consume update overhead."&lt;/p&gt;

&lt;p&gt;At 200 GB, adding an index is something an engineer does before lunch. At 4 TB the same change needs a maintenance window and someone watching replica lag until it finishes. When a simple DDL change takes that much planning, the database has reached its practical size limit, whatever the disk says.&lt;/p&gt;

&lt;p&gt;Restore time sets the hard ceiling. The recovery time objective (RTO) is the downtime the business accepts after a failure, and a database you can't restore within it is too large, however well it runs day to day. A restore has to move every byte of the backup onto a working volume before anything else can happen, and that copy alone takes data size divided by throughput. Amazon Elastic Block Store (EBS) includes &lt;a href="https://docs.aws.amazon.com/ebs/latest/userguide/general-purpose.html" rel="noopener noreferrer"&gt;125 MiB/s of baseline throughput with every gp3 volume&lt;/a&gt;, and gp3 can be provisioned up to 2,000 MiB/s, provided the instance has &lt;a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-io-characteristics.html" rel="noopener noreferrer"&gt;that much EBS bandwidth&lt;/a&gt;. A volume created from a snapshot can be &lt;a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-initialize.html" rel="noopener noreferrer"&gt;initialized at up to 300 MiB/s&lt;/a&gt; at extra cost.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Data size&lt;/th&gt;
&lt;th&gt;At 125 MiB/s&lt;/th&gt;
&lt;th&gt;At 300 MiB/s&lt;/th&gt;
&lt;th&gt;At 2,000 MiB/s&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1 TiB&lt;/td&gt;
&lt;td&gt;2 h 20 min&lt;/td&gt;
&lt;td&gt;58 min&lt;/td&gt;
&lt;td&gt;9 min&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2 TiB&lt;/td&gt;
&lt;td&gt;4 h 40 min&lt;/td&gt;
&lt;td&gt;1 h 57 min&lt;/td&gt;
&lt;td&gt;17 min&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4 TiB&lt;/td&gt;
&lt;td&gt;9 h 19 min&lt;/td&gt;
&lt;td&gt;3 h 53 min&lt;/td&gt;
&lt;td&gt;35 min&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8 TiB&lt;/td&gt;
&lt;td&gt;18 h 38 min&lt;/td&gt;
&lt;td&gt;7 h 46 min&lt;/td&gt;
&lt;td&gt;1 h 10 min&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Time to copy a backup onto a working volume, by data size and throughput. This is arithmetic, not a measurement, and it is the fastest a restore can possibly go: it excludes index rebuilds, log replay and warm-up.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F552adf1b-6f4e-46df-b46d-54ed8064e646.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F552adf1b-6f4e-46df-b46d-54ed8064e646.gif" alt="The restore-floor table rendered as a clock at gp3's 125 MiB/s baseline, showing that with a 4-hour RTO only the 1 TiB database has finished copying when the time is up" width="760" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The restore-floor table as a clock, at gp3's 125 MiB/s baseline. With a 4-hour RTO, only the 1 TiB database has finished copying when the time is up.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A real restore is slower than the copy. A logical restore with &lt;code&gt;mysqldump&lt;/code&gt; or &lt;code&gt;pg_dump&lt;/code&gt; rebuilds every index after loading the rows. Point-in-time recovery then replays the MySQL binary log or the Postgres write-ahead log (WAL) from the backup up to the moment of failure. A volume restored from an EBS snapshot pulls its blocks from Amazon S3 on first access, and AWS warns it "might experience increased I/O latency and decreased performance" until every block has arrived. The replicas lost in the same incident need rebuilding too, and until they are, the restored primary has no failover target.&lt;/p&gt;

&lt;p&gt;To find the limit for your own database:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Restore a production-sized backup on production-class hardware, end to end and including point-in-time recovery, and time it. Data size divided by that time is your effective restore throughput.&lt;/li&gt;
&lt;li&gt;Multiply that throughput by your RTO, after subtracting the time it takes to notice the failure and decide to restore. The result is the largest database you can recover in time.&lt;/li&gt;
&lt;li&gt;Time the largest index build or &lt;code&gt;ALTER TABLE&lt;/code&gt; on your biggest table, along with the replica lag it causes. If that doesn't fit your change windows, your limit is lower than the restore says.&lt;/li&gt;
&lt;li&gt;Compare your growth rate with how long a sharding project takes your team, and start when you're that far from the limit rather than at it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As an example, a team with a four-hour RTO whose measured end-to-end restore runs at 150 MiB/s can recover 14,400 seconds × 150 MiB/s = 2,160,000 MiB, or 2.06 TiB, before detection time is taken off. Double the throughput to 300 MiB/s and the same four hours cover 4,320,000 MiB, or 4.12 TiB. Those two results bracket our 2 to 4 TB rule: a four-hour RTO and a restore pipeline sustaining 150 to 300 MiB/s end to end puts the ceiling for one database in that range. A team with a shorter RTO or a slower restore gets a lower number, and should start the sharding work well before reaching it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which scaling problems can you solve without sharding?
&lt;/h2&gt;

&lt;p&gt;Read pressure is the one reason to shard that has a good answer short of sharding. Data size and restore time are properties of the data itself, and write throughput is a property of the single primary, so only splitting the data (or deleting some of it) changes them. Reads behave differently. Applications ask for the same results over and over, and serving those results from somewhere other than the primary takes load off it without moving a single row.&lt;/p&gt;

&lt;p&gt;Readyset is a cache built for that case. Readyset sits between the application and MySQL or Postgres, speaks their wire protocols, and answers cached queries from memory. A deep cache stays current by applying changes from the MySQL binary log or the Postgres WAL through incremental view maintenance, so a write shows up in the cached result without the application invalidating anything. A shallow cache refreshes its results on a time-to-live (TTL) instead. Writes and uncached queries pass through to the database unchanged.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F88ed3bfc-55ad-428f-ae39-08c55691c86a.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2F88ed3bfc-55ad-428f-ae39-08c55691c86a.gif" alt="Taking read load off the primary with Readyset: the application sends unchanged queries to Readyset, which answers repeated reads from its cached result while writes pass through to the MySQL or Postgres primary, and the change stream (MySQL binlog or Postgres WAL) updates the cached result in place" width="799" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Repeated reads stop at Readyset. The write reaches the primary, and the change returns through the MySQL binlog or Postgres WAL to update the cached result in place.&lt;/em&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Reason you're considering sharding&lt;/th&gt;
&lt;th&gt;Read replicas&lt;/th&gt;
&lt;th&gt;Readyset&lt;/th&gt;
&lt;th&gt;Sharding&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Repeated reads saturate the primary&lt;/td&gt;
&lt;td&gt;Helps, with replication lag on every replica&lt;/td&gt;
&lt;td&gt;Helps: repeated queries are answered from memory&lt;/td&gt;
&lt;td&gt;Helps, at the cost of splitting the data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The working set is outgrowing RAM because of hot reads&lt;/td&gt;
&lt;td&gt;Partly: every replica needs the same RAM as the primary&lt;/td&gt;
&lt;td&gt;Helps for cached queries; the database still needs memory for writes and uncached reads&lt;/td&gt;
&lt;td&gt;Helps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One server can't absorb the writes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Restores and DDL changes take too long&lt;/td&gt;
&lt;td&gt;No: a replica rebuild is the same size as a restore&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The data set is outgrowing one server's storage&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Which tool addresses which sharding trigger? Readyset and read replicas only act on read load; size, restore time, and write throughput need the data split.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Readyset doesn't shrink the database or shorten a restore. If a restore already takes longer than your RTO, caching reads leaves that problem exactly where it was. When read load is what's pushing you toward sharding, a cache moves the date: it buys back the headroom that sharding needs before it starts, so the work runs on a schedule instead of during an incident.&lt;/p&gt;

&lt;p&gt;Readyset also works inside a sharded fleet. Readyset connects to a single upstream database, so in an application-sharded MySQL or Postgres deployment each shard gets its own Readyset, and the shard map points at that Readyset instead of at the shard's primary. Each cache then holds results for one shard's rows only. The router still merges queries that fan out across shards.&lt;/p&gt;

&lt;p&gt;The number behind most of these decisions is how long a full restore of your largest database takes, and it's cheap to measure before anything depends on it. If reads are what's pushing you toward sharding first, the &lt;a href="https://readyset.io/docs/" rel="noopener noreferrer"&gt;Readyset documentation&lt;/a&gt; covers putting a cache in front of a single MySQL or Postgres database.&lt;/p&gt;

</description>
      <category>databasescaling</category>
      <category>mysql</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Less Work per Query: Speeding Up Readyset’s Text Protocol</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Mon, 02 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/less-work-per-query-speeding-up-readysets-text-protocol-2pkg</link>
      <guid>https://dev.to/readyset/less-work-per-query-speeding-up-readysets-text-protocol-2pkg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn4q8116vq2gt76rrwnr2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn4q8116vq2gt76rrwnr2.png" alt="Less Work per Query: Speeding Up Readyset’s Text Protocol" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Readyset is in the business of making your queries faster. If you are trying to improve your application’s performance, or reduce load on your database, one of the first things people will tell you is to use prepared statements. What if you can’t? Readyset’s latest release improves performance for ad hoc queries, and this post talks about some of the optimizations we made.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why are prepared statements faster?
&lt;/h2&gt;

&lt;p&gt;Prepared statements (sometimes "binary protocol”) are faster than ad hoc statements (sometimes "text protocol”) for a simple reason: they avoid repeating work. Instead of parsing, planning, and optimizing a query every time it executes, you do that work once in a &lt;code&gt;PREPARE&lt;/code&gt; step. You get a handle to the prepared statement, and can &lt;code&gt;EXECUTE&lt;/code&gt; it as many times as you want. You pay once for (most of) the work that is common to every statement execution, and each execution (mostly) only pays for the part that matters: actually getting the data.&lt;/p&gt;

&lt;p&gt;Usually, by the time a customer comes to Readyset looking to soothe their database pains, they are already using prepared statements. The problem is, they require application changes. Many customers are trying to improve performance or reduce load on applications that are already legacy, or they don’t have control over (infra teams instead of dev teams), or for some other reason could not be expected to modify queries. That’s why we offer a transparent caching layer in the first place. However, until now, we have not spent much time optimizing our ad hoc statement path. So if one of those customers’ existing applications happened to be using ad hoc statements instead of prepared statements, they should still see Readyset’s signature massive speedup… but it wouldn’t be quite as impressive as the speedup they would get if they were also using prepared statements.&lt;/p&gt;

&lt;p&gt;In our latest release, we have done some optimization of the text protocol path. We knew there would be overhead to trim down when each query arrives as SQL text that has to be handled afresh every time. We don't have space to discuss all ~12 significant improvements (depending on how you count), so this post will cover 4 interesting examples. Then, a sequel to this post will describe our new parse cache which is an even bigger jump and brings ad hoc query performance &lt;em&gt;much&lt;/em&gt; closer to the prepared statement path.&lt;/p&gt;

&lt;p&gt;To give you an idea of the scale of improvement just from these ~12 small changes: in a warmed cached point-read test with 1024 clients, this release handled about 2.7 times more throughput than the previous release when using ad hoc statements. That’s our fast case, and we care a lot about making it faster. But that difference only reflects a portion of all the changes. Often, stuff off the happy/hot path can matter just as much. (Have you ever profiled your error paths?) Anyway, let’s get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does Readyset process a query?
&lt;/h2&gt;

&lt;p&gt;I suppose if you want to understand the improvement we've made to handling queries when they reach the text protocol (or, for that matter, the first time you &lt;code&gt;PREPARE&lt;/code&gt; them), we had better understand what the handling process looks like. Once we know which cache to hit and which key to look up, the cached-read path is already pretty well optimized. But getting from SQL text to that cache and key can involve quite a bit of work.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Farchitecture-simple.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Farchitecture-simple.svg" alt="Text-protocol query path from SQL decoding through parsing, rewriting, routing and a cached-result lookup to encoded results." width="1400" height="660"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Readyset has two caching modes. Pull-based caching is a TTL-based cache of results retrieved from the upstream database. Push-based caching uses partially-stateful dataflow (&lt;a href="https://pdos.csail.mit.edu/papers/noria:osdi18.pdf" rel="noopener noreferrer"&gt;&lt;em&gt;Noria&lt;/em&gt; OSDI ’18&lt;/a&gt;) to maintain query results from database changes only for results you care about based on a CDC stream from the upstream database.&lt;/p&gt;

&lt;p&gt;Reading those results starts with finding the corresponding cache, if one exists. This has to respect SQL semantics and things like schema search path/current database. Then we need the cache key: in a prepared statement, the values come from bound parameters, but for an ad hoc query, we have to extract literals from the AST and map them to cache key positions and values. Pull- and push-based caching use similar processes to identify the cache and key, and some parts are shared. (It doesn’t matter much, but technically the following examples assume a push-based cache.)&lt;/p&gt;

&lt;p&gt;For example, with a &lt;code&gt;users(id, name, active)&lt;/code&gt; table, Readyset needs to auto-parameterize the literal &lt;code&gt;42&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- original SQL&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;-- auto-parameterize&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then it can look up the corresponding cache for that shape, and then look up the value for key &lt;code&gt;42&lt;/code&gt;. If this were a prepared statement, the &lt;code&gt;42&lt;/code&gt; wouldn’t need to be auto-parameterized.&lt;/p&gt;

&lt;p&gt;As you can imagine, there is a lot of complexity hiding in and around those “parse, rewrite, route" boxes in the diagram above. That’s why I very cleverly asked Claude to add an “etc.” box too. Session variables and current DDL state affect how a query is rewritten and what the lookup key should be, some literals should be auto-parameterized and not others, and so on. A more detailed diagram is at the end of this post, but even that mostly only calls out the boxes where we made improvements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why were we applying SQL rewrites that were no-ops?
&lt;/h2&gt;

&lt;p&gt;Auto-parameterization isn’t the only SQL AST rewrite pass. Even for this simple query, we need to expand stars and resolve columns:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- auto-parameterized&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;-- normalize: expand stars, resolve columns, etc.&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This brings us to one of the ~12 improvements (depending on how you count) we made in this release: aren’t some SQL rewrites no-ops for some queries? For example, our support for subqueries in push-based dataflow relies on an “inline derived tables” rewrite. It might look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- original SQL&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;active_users&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;active_users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;-- normalize: inline derived tables, etc. (parameters: 42, true)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rewrite passes have to do some fairly nontrivial work: resolve columns to the right table in the right subquery, pick aliases to avoid conflicts, move the inner filter into the outer filter, and so on. For more detail, see &lt;a href="https://readyset.io/blog/how-readyset-rewrites-your-sql-inside-the-query-transformation-pipeline" rel="noopener noreferrer"&gt;how Readyset rewrites SQL&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Our original point query doesn’t have a derived table, so it doesn’t need to do any of that work. In this case, it’s obvious. For some of our rewrite passes, it’s less obvious when it can be safely skipped, so we were applying the rewrites even when they were ultimately no-ops.&lt;/p&gt;

&lt;p&gt;This was one of the first things to show up in flamegraphs when we started this optimization effort. But if all we had seen was “rewrites take a good chunk of the CPU cycles for each query”, we might nonetheless have looked elsewhere. However, this was surprising, because this was showing up in flamegraphs with point selects like the first example, too, not just arbitrary query workloads.&lt;/p&gt;

&lt;p&gt;Optimization is all about deciding what to measure. This means both the specific observable metrics you collect and compare, whether you are profiling CPU or instrumenting memory allocations, etc.; but also the workload you run. We used a variety, and saw different problems become more prominent in flamegraphs, throughput measurements, lock contention, etc. depending on which workload was running. In this case, point selects generally represent the &lt;em&gt;best case&lt;/em&gt; for the "parse, rewrite, route” part of processing a text-protocol query. As a result, looking at a flame graph for a point select with no derived tables and seeing the derived table rewrite taking up a non-negligible amount of time raised our eyebrows, and took us down that path.&lt;/p&gt;

&lt;p&gt;Here is what the deep rewrites part of the flamegraph looked like profiling point select queries with and without skipping no-op rewrites, saving about 23% of CPU cycles on rewrites:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;SQL rewrite CPU cycles per query. Hover or tap to highlght correlated frames.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Of course, that isn't going to affect queries that &lt;em&gt;do&lt;/em&gt; need those rewrites, but most queries will at least skip some rewrites.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why were unrelated tables affecting query latency?
&lt;/h2&gt;

&lt;p&gt;The query itself isn’t the only part of the workload that matters. In a stateful system, state tends to accumulate. Could unrelated state impinge on the handling of a query? What happens if we run the same point select, but add a few hundred tables into the same database that the query doesn’t even reference?&lt;/p&gt;

&lt;p&gt;To rewrite a query, Readyset needs information about table schemas. In our example, it needs to know which columns &lt;code&gt;users&lt;/code&gt; has to expand &lt;code&gt;SELECT *&lt;/code&gt;, and where &lt;code&gt;id&lt;/code&gt; comes from. But the work we were doing to make that information available also depended on tables that had nothing to do with the query. Effectively, we were building a hashmap of &lt;em&gt;all&lt;/em&gt; relations and all their columns before we started the rewrite passes. A point select against one table was building a hashmap for tens or hundreds of tables. We changed this to look up schema information as the rewrite needs it.&lt;/p&gt;

&lt;p&gt;This also meant the larger your database, the wider the gap after it was fixed. With 500 unrelated tables, median latency dropped by 8x at a fixed query rate, and without the rate cap, throughput increased by 7x. Bet Marketing would love it if that were the headline! On the other hand, at 200 tables it’s the difference between 452 µs and 122 µs, and at 10 unrelated tables any difference was lost to run-to-run noise.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Fextra-schema-latency.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Fextra-schema-latency.svg" alt="Throughput and p50/p99 latency versus unrelated table count for stable-260924 and stable-261022." width="1440" height="1100"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Throughput and latency by number of unrelated tables.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why were we updating statuses that haven't changed?
&lt;/h2&gt;

&lt;p&gt;After we’ve processed a query, Readyset will store (some might say "cache”) some information about it so we don't have to check again next time we execute it. Is there a cache? Should it go upstream? We store and retrieve that information in the &lt;code&gt;QueryStatusCache&lt;/code&gt;. However, when we started measuring throughput under high concurrent load on the text protocol, we discovered we were taking a global write lock to update query status for an existing entry even when it hadn’t changed (and it rarely does). We had never noticed while optimization was focused on the binary protocol, because prepared statements would only take the write lock once at &lt;code&gt;PREPARE&lt;/code&gt; time and then reuse the handle.&lt;/p&gt;

&lt;p&gt;We simply added a condition to an &lt;code&gt;if&lt;/code&gt;: check whether there is actually anything to change before taking the global write lock. Lock contention hazards like this often show themselves as a flattening (or worse yet, a cliff) in the throughput curve as concurrency increases, and in one benchmark we saw that starting as low as 96 concurrent clients. But that was with &lt;em&gt;none&lt;/em&gt; of the changes in this release.&lt;/p&gt;

&lt;p&gt;The previous graph was comparing release-to-release, where you can hopefully still see where specific areas of the product improve. But several different changes removed nonspecific throughput barriers like this one, so I honestly couldn't find a good way to isolate the effect of just this change, other than by hacking in a runtime toggle for that new if condition. That lets the effect of this change be seen more clearly, instead of leaving us at such low throughput that we wouldn't notice much of a difference. So although overall throughput under the same benchmark went up 2.7x from release to release, the portion due to &lt;em&gt;this&lt;/em&gt; particular change was only ~18%: throughput at 1,024 clients went from 510k to 602k queries per second, and p99 latency fell from 4.18 to 3.68 ms. The throughput curve was able to go up further in this test, and the fact that without this guard (but with other changes) throughput is already going &lt;em&gt;down&lt;/em&gt; from 384 to 768 means that although it was a small change on its own, it was a big part of the overall performance gain in this release.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Fstatus-lock-ablation-sweep.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Fstatus-lock-ablation-sweep.svg" alt="Text-protocol throughput from 48 to 1,024 clients in stable-261022 with the status guard off and on." width="1536" height="904"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Text-protocol throughput with the status guard off and on.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;By this point we’re hitting the box’s CPU capacity and the curve is flattening out, with both the load generator and Readyset running on it. While &lt;em&gt;I&lt;/em&gt; enjoyed measuring the impact of this 1 line diff on a shared box, &lt;em&gt;you&lt;/em&gt; probably want to see how far the cached-read path can really go. For that, check out &lt;a href="https://readyset.io/case-studies/how-we-reached-43-million-qps-for-mysql-and-postgresql-workloads-on-a-single-readyset-node" rel="noopener noreferrer"&gt;Marcelo’s post&lt;/a&gt; with separate load generators and a 10 Gbps NIC. That benchmark uses prepared statements (see the first paragraph of this post), so it’s measuring a different path from the text-protocol work here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why were we accumulating excessive query logs?
&lt;/h2&gt;

&lt;p&gt;Similar to unrelated tables/queries affecting processing of one query, not all of the work we do for a query is needed to return a result. We also log query information asynchronously, so queries don’t have to wait for the logger. But what happens if queries produce that information faster than the logger can consume it? Seems like it should be unlikely, and we wouldn’t notice if logging is only on &lt;code&gt;PREPARE&lt;/code&gt;. Plus... by the time we got to this item, ad hoc queries were a lot faster.&lt;/p&gt;

&lt;p&gt;Without a bound on the queue, we could keep accepting queries while accumulating gigabytes of logging work. We bounded the queue, allowing some telemetry to be dropped when the logger falls behind. In an overload test, transient memory use just from the queue went from about 15 GB to 310 MB. Throughput also went up from 1.24 million to 1.35 million queries per second. About 4% of telemetry was dropped in that run. That’s a tradeoff, but life is full of tradeoffs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion and results: how fast is Readyset’s text protocol now?
&lt;/h2&gt;

&lt;p&gt;These might seem like odd examples for a post about making queries faster. It was mostly just &lt;em&gt;not doing&lt;/em&gt; things we didn't need to. In fact, arguably much of these didn’t actually have to do with &lt;em&gt;serving the query&lt;/em&gt; but with other tangential parts of the system (though we made plenty of other changes to the hot path too).&lt;/p&gt;

&lt;p&gt;Okay, where did we end up? Well, at the risk of repeating the number 2.7 yet again… 2.7 times higher throughput! Specifically in the warmed cached point-select benchmark which was the worst case for text protocol overhead. At 1,024 clients. At 192 clients, median latency fell by 69%, p95 by 48%, and p99 by 20%. Yeah, I’ve picked these numbers out basically at random, and could have gotten pretty similar numbers from basically every benchmark we ran that didn’t use prepared statements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Ftext-protocol-release-summary.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Ftext-protocol-release-summary.svg" alt="Throughput from 48 to 1,024 clients and p50/p95/p99 latency at 192 clients: stable-260924 in black and stable-261022 in purple." width="1440" height="760"&gt;&lt;/a&gt; &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Ftext-protocol-release-summary-stacked.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Freadyset.io%2Fimages%2Fblog%2Ftext-protocol%2Ftext-protocol-release-summary-stacked.svg" alt="Throughput from 48 to 1,024 clients and p50/p95/p99 latency at 192 clients: stable-260924 in black and stable-261022 in purple." width="600" height="1140"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Text-protocol throughput by client count; latency at 192 clients.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: can we make Readyset’s text protocol even faster?
&lt;/h2&gt;

&lt;p&gt;Well, after harping about not doing stuff for so long, you must be convinced that laziness is indeed a virtue. And in a follow-up post, we’ll go another level deeper: what if we can avoid doing &lt;em&gt;any&lt;/em&gt; of the work we just discussed, and make Readyset’s text-protocol performance even closer to the prepared statement path?&lt;/p&gt;

&lt;p&gt;In the meantime, here is a more detailed diagram which shows the places we made some other noticeable improvements in this release.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Text-protocol query path. Hover or focus a numbered marker to highlight its component.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Commits on GitHub: &lt;a href="https://github.com/readysettech/readyset/commit/28a841191f252370cc5761d531fc346b4ab5d40d" rel="noopener noreferrer"&gt;1. Read less schema&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/6dfcf4ce4df8e955ba458e870dc739c2de796589" rel="noopener noreferrer"&gt;2. Skip no-op rewrites&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/1a969c0d1d6ee4453637d79c999f8f58370b6f59" rel="noopener noreferrer"&gt;3. Combine passes&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/c4d4a3b266e35ea564b14eab1b482226f554c246" rel="noopener noreferrer"&gt;4. Streaming hashing&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/7c66b2e0b143edf3efd129fbf43151b9301245fc" rel="noopener noreferrer"&gt;5. Skip unused errors&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/cea21387a85acdf070bfc3c6bd547b160bc5c2c9" rel="noopener noreferrer"&gt;6. Faster schema access&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/1fdce46d72898e61a18439b6c769606bde8cf2c4" rel="noopener noreferrer"&gt;7. Skip unchanged updates&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/5b8224109fd099d7a5cb9f54975945cc5f1c4fb8" rel="noopener noreferrer"&gt;8. Stamp only on change&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/0d73ab2aa32406d211bbb195fe3d96ba72758396" rel="noopener noreferrer"&gt;9. Keep logging bounded&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/3f31159c3c1ee6e71ba7e65ed17a77137887ed24" rel="noopener noreferrer"&gt;10. Connect with fewer trips&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/30902ec0384a6f15e3c886a477c4daccd6315c11" rel="noopener noreferrer"&gt;11. Copy only samples&lt;/a&gt;, &lt;a href="https://github.com/readysettech/readyset/commit/1c05ab567aeb4f1b8883580778903b70fdab7145" rel="noopener noreferrer"&gt;12. Reuse result buffers&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclaimer: This post’s prose was machine-generated by a 36-key Beekeeb Piantor Pro operated by an artificially intelligent bio-appendage prone to hallucination. The diagrams’ SVG were handwritten by some people named Claude and Astra.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>engineering</category>
    </item>
    <item>
      <title>October Product Update 2026</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Mon, 02 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/october-product-update-2026-2mhm</link>
      <guid>https://dev.to/readyset/october-product-update-2026-2mhm</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhdu9r4vhthr2zfvheq5s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhdu9r4vhthr2zfvheq5s.png" alt="October Product Update 2026" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;October was a big release month at Readyset, with an exciting new RDST capability and the longest list of features and fixes we've shipped in a release this year. Let's catch up.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The RDST Agent Is Here&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;RDST now features an always-on agent that watches your Postgres or MySQL database for queries that are getting slower, busier, or changing plans, and flags them with a recommended fix.&lt;/p&gt;

&lt;p&gt;The agent reads your database's query stats every minute and keeps a day-by-day record of each query shape. Instead of a lifetime average that buries yesterday's slowdown under three months of fast runs, it checks every five minutes whether each busy query is slower or busier than it usually is. When something changes, RDST agent investigates on its own: it runs &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; with real values from live traffic, explains what happened, and hands you the fix. Once you apply the fix, it confirms it worked.&lt;/p&gt;

&lt;p&gt;In our walkthrough, a deploy made one query 30x slower. The agent flagged it within nine minutes, found the missing index, and confirmed the fix took the query from 184 ms to 3.8 ms.&lt;/p&gt;

&lt;p&gt;Read-only, so it never writes to your database. Free and open source. Available now in the &lt;a href="https://readyset.io/downloads" rel="noopener noreferrer"&gt;RDST desktop app&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://readyset.io/blog/meet-the-rdst-agent" rel="noopener noreferrer"&gt;Read the full launch post here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;💬 Product Updates&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A quick naming note: Readyset's two caching modes, previously called shallow and deep caching, now go by pull-based and push-based caching, named after how each one keeps results fresh. A pull-based cache pulls new results from the database on a schedule, while a push-based cache has every write pushed into the cached results as it happens. Same products, just going by new names.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;New Admin SQL Port for Readyset:&lt;/strong&gt; Readyset now ships a dedicated admin SQL port. Admin sessions connect to the &lt;code&gt;readyset&lt;/code&gt; schema instead of the upstream database, keep their own credentials, and run commands that affect Readyset itself rather than queries against your data. The first admin-only command, &lt;code&gt;ALTER READYSET SHUTDOWN [RESET]&lt;/code&gt;, lets operators shut down a Readyset instance, configure the port with &lt;code&gt;--admin-address&lt;/code&gt; (default &lt;code&gt;127.0.0.1:6036&lt;/code&gt;) and &lt;code&gt;--admin-credentials&lt;/code&gt; (default &lt;code&gt;admin:admin&lt;/code&gt;), or disable it with &lt;code&gt;--admin-address disabled&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Session-Variable Isolation for Pull Caches:&lt;/strong&gt; A batch of fixes so pull cache entries no longer leak between sessions whose session variables would produce different query results. Pull cache entries are now keyed on the MySQL upstream's global value of the session variables that affect results, and on each PostgreSQL connection's &lt;code&gt;IntervalStyle&lt;/code&gt; (whether inherited from the upstream or set in the session), &lt;code&gt;timezone_abbreviations&lt;/code&gt;, and &lt;code&gt;default_text_search_config&lt;/code&gt;. Sessions with different values now see their own cached results instead of each other's.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dual-Password Support for MySQL:&lt;/strong&gt; &lt;code&gt;ALTER READYSET MODIFY USER ... RETAIN CURRENT PASSWORD&lt;/code&gt; keeps the old password valid alongside the new one, and &lt;code&gt;... DISCARD OLD PASSWORD&lt;/code&gt; retires it. Naming a user twice in &lt;code&gt;--allowed-users&lt;/code&gt; starts a deployment mid-rotation. The &lt;code&gt;readyset.users&lt;/code&gt; view reports rotations in progress in a new &lt;code&gt;has_old_password&lt;/code&gt; column, so operators can run safe password rotations without a window where auth breaks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multi-Upstream MySQL and Smarter Connection Handling:&lt;/strong&gt; &lt;code&gt;--upstream-db-url&lt;/code&gt; and &lt;code&gt;--cdc-db-url&lt;/code&gt; now accept a comma-separated list of MySQL servers, each with an optional &lt;code&gt;|&amp;lt;weight&amp;gt;&lt;/code&gt; suffix. Added &lt;code&gt;--upstream-connect-timeout&lt;/code&gt; to limit how long the adapter waits for an upstream connection, &lt;code&gt;--client-connect-timeout-ms&lt;/code&gt; to disconnect MySQL and PostgreSQL clients that don't complete the handshake within 10 seconds by default, and &lt;code&gt;--listen-backlog&lt;/code&gt; (default 4096, up from 128) so connection bursts are less likely to leave clients stalled until they time out.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Safer Memory Limit Defaults:&lt;/strong&gt; &lt;code&gt;--memory-limit&lt;/code&gt; now defaults to 80% of the memory available to Readyset (the container limit, if set) instead of unlimited. Set &lt;code&gt;--memory-limit&lt;/code&gt; to 0 to keep the previous unlimited behavior). In push and push-then-pull cache modes, the pull cache now uses half of &lt;code&gt;--memory-limit&lt;/code&gt; when &lt;code&gt;--pull-memory-percent&lt;/code&gt; isn't set, instead of being unbounded.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Wider Pull Cache Coverage on PostgreSQL:&lt;/strong&gt; Pull caches now serve queries over views created after Readyset started (previously these were never pull cached), and support &lt;code&gt;point&lt;/code&gt;, &lt;code&gt;box&lt;/code&gt;, &lt;code&gt;path&lt;/code&gt;, and &lt;code&gt;cidr&lt;/code&gt; values over the extended query protocol. Fixed a case where Readyset couldn't start in pull mode with RLS enabled against a PostgreSQL upstream whose certificate was signed by a private CA.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Faster Text Queries:&lt;/strong&gt; Improved throughput for queries sent as text, which previously serialized on two locks: the schema catalog lock and another shared lock. Workloads with heavy text-protocol query traffic now see higher throughput under concurrency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;More Queries Served From Cache:&lt;/strong&gt; A batch of fixes expanding what Readyset caches instead of proxying upstream. MySQL caches created with &lt;code&gt;?&lt;/code&gt; placeholders are now served from cache rather than sent to the upstream. Row comparisons with literals or placeholders on the left side (such as &lt;code&gt;($1, $2) = (a, b)&lt;/code&gt;) are now cached as lookups, and row comparisons mixing literals and columns (such as &lt;code&gt;('a', b) = ('c', 'd')&lt;/code&gt;) are now cached instead of rejected with a placeholder error. Push caches created from a query ID in &lt;code&gt;SHOW PROXIED QUERIES&lt;/code&gt; using &lt;code&gt;CREATE CACHE FROM &amp;lt;query id&amp;gt;&lt;/code&gt; are also correctly recreated on restart.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Plus 15 additional fixes and improvements. Check out the full release &lt;a href="https://github.com/readysettech/readyset/releases/tag/stable-261022" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  New on the Blog &amp;amp; YouTube
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://readyset.io/blog/less-work-per-query-speeding-up-readysets-text-protocol" rel="noopener noreferrer"&gt;Less Work per Query: Speeding Up Readyset’s Text Protocol&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Michael Victor Zink writes about making Readyset’s ad hoc queries faster by doing less work per query (skipping no-op rewrites, ignoring unrelated tables, avoiding needless locks, and bounding the query log) for 2.7x higher throughput at 1,024 clients.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://readyset.io/blog/what-is-a-wire-compatible-sql-caching-proxy" rel="noopener noreferrer"&gt;What Is a Wire-Compatible SQL Caching Proxy?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Caching SQL can live in two places: scattered through your application code with Redis, or in a layer that speaks the database's own wire protocol. The second option moves cache keys, invalidation logic, and the hit-or-miss decision out of the codebase entirely. This post walks through what wire compatibility actually requires at the MySQL and PostgreSQL protocol level, where Redis still fits, and why incremental view maintenance makes this different from a store you fill and empty by hand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://readyset.io/blog/readyset-ha-proxysql-mysql" rel="noopener noreferrer"&gt;Readyset HA with ProxySQL and MySQL&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Vinicius Grippa builds a highly available Readyset cache behind a 106 ms report query, using two &lt;code&gt;docker run&lt;/code&gt; commands and two &lt;code&gt;INSERT&lt;/code&gt; statements in ProxySQL's admin interface. Nothing changes in the application, the schema, or MySQL. The query drops to 0.716 ms, a 149x improvement, and the setup survives losing a Readyset node or a ProxySQL node with no downtime. Also covers the three ways to confirm the cache is actually serving reads instead of silently falling through to the database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=BsziEgFDIK0" rel="noopener noreferrer"&gt;Watch: "Building the Invisible Cache"&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Tanmay Sinha’s talk from MySQL BR Conf 2026 is now up on YouTube. His talk covers why the original MySQL query cache failed, why hand-rolling one on Redis leaves the hardest parts to your team, and what wire-compatible caching changes about that, and is followed by a demonstration by Vinicius Grippa.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://readyset.io/blog/black-october-what-actually-happened-and-what-to-patch" rel="noopener noreferrer"&gt;Black October: What Actually Happened, and What To Patch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A primary-source review of the 28 "Black October" security incidents. Only two involved AI-driven attacks. The real damage came from long-lived credentials stored in platform environment variables and shared vendor systems. Includes the specific database-tier patches to apply this week and six steps for cutting credential risk.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://readyset.io/blog/a-ttl-cache-needs-to-know-the-query" rel="noopener noreferrer"&gt;A TTL Cache Needs To Know the Query&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Marcelo Altmann on why cache-aside on Redis struggles with SQL once a workload hits real load: a key-value store can't re-run a query, so it can't refresh hot keys, collapse miss stampedes, weigh a 900 ms report against a 2 ms lookup, or key by session settings and user permissions. The strongest evidence for the argument comes from Redis itself, which ships two separate products (Smart Cache and Redis Data Integration) aimed at the exact gap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get Involved
&lt;/h2&gt;

&lt;p&gt;Questions, bugs, ideas, or just want to say hi? Find us on &lt;a href="https://go.readyset.io/community" rel="noopener noreferrer"&gt;Slack&lt;/a&gt;. Looking to contribute? Our &lt;a href="https://github.com/readysettech/readyset/issues?q=is%3Aissue+is%3Aopen+label%3Afirst-issue" rel="noopener noreferrer"&gt;newcomer issues&lt;/a&gt; are a good place to start.&lt;/p&gt;

</description>
      <category>productupdates</category>
      <category>postgres</category>
      <category>mysql</category>
      <category>product</category>
    </item>
    <item>
      <title>Introducing Automatic Failover and Multi Server Support</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Thu, 29 Oct 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/introducing-automatic-failover-and-multi-server-support-50p9</link>
      <guid>https://dev.to/readyset/introducing-automatic-failover-and-multi-server-support-50p9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9t1f1lfu84at1191iy72.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9t1f1lfu84at1191iy72.png" alt="Introducing Automatic Failover and Multi Server Support" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most production MySQL deployments run a primary and a few replicas. If the primary fails, you promote a replica and point your application at it. That's failover: how a database stays up when a server goes down.&lt;/p&gt;

&lt;p&gt;Starting in Readyset &lt;a href="https://github.com/readysettech/readyset/releases/tag/stable-261022" rel="noopener noreferrer"&gt;1.33&lt;/a&gt;, you can give Readyset a list of servers. It handles failovers automatically, resumes replication on another server without losing or repeating changes, and spreads proxied queries across your replicas.&lt;/p&gt;

&lt;p&gt;Readyset sits between your application and the database, and it talks to the database in two ways. It reads the replication stream (change data capture, or CDC) to keep its caches current. It also forwards queries it doesn't cache, along with cache misses, to the database.&lt;/p&gt;

&lt;p&gt;Until now, each of those connections pointed at exactly one server. That left two gaps. If the server Readyset replicated from went down, the CDC stream stopped, and caches fell behind until someone manually repointed Readyset. And if you had several replicas with spare capacity, Readyset still sent all its proxied traffic to one of them.&lt;/p&gt;

&lt;p&gt;This release supports MySQL with GTIDs enabled. PostgreSQL is covered with limitations.&lt;/p&gt;

&lt;p&gt;Here's how it works:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2Ff0546a31-200e-4936-989d-2dd7e03b594b.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2Ff0546a31-200e-4936-989d-2dd7e03b594b.gif" alt="Readyset failing over between MySQL servers and resuming replication from the last applied GTID" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you configure Readyset with multiple servers?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;--upstream-db-url&lt;/code&gt; and &lt;code&gt;--cdc-db-url&lt;/code&gt; now take a list. Separate the URLs with commas (or repeat the option), and add an optional &lt;code&gt;|&amp;lt;weight&amp;gt;&lt;/code&gt; from 1 to 100 to each one. The default weight is 50.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--cdc-db-url 'mysql://user:pass@replica-a:3306/db|60,mysql://user:pass@replica-b:3306/db|50,mysql://user:pass@replica-c:3306/db'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A single URL still works exactly as before, so existing deployments don't need to change anything.&lt;/p&gt;

&lt;p&gt;The two flags keep separate lists. &lt;code&gt;--cdc-db-url&lt;/code&gt; is where replication and snapshotting read from. &lt;code&gt;--upstream-db-url&lt;/code&gt; is where Readyset sends queries it doesn't serve from cache. If you only set &lt;code&gt;--upstream-db-url&lt;/code&gt;, CDC uses the same list.&lt;/p&gt;

&lt;p&gt;Every server in a list must have &lt;code&gt;gtid_mode=ON&lt;/code&gt;, use the same database name, and have identical &lt;code&gt;lower_case_table_names&lt;/code&gt;, time zone, and server collation. Readyset connects to each server at startup and checks this. A wrong password or a server without GTIDs stops startup with an error that names the server. If a server is unreachable, it gets logged and marked down, and startup continues as long as one server passes. In a large pool, one replica that is rebooting shouldn't block a restart.&lt;/p&gt;

&lt;p&gt;To check the list of servers, you can execute the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;readyset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;upstream_servers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get one row per server with its weight, its purpose (&lt;code&gt;cdc&lt;/code&gt;, &lt;code&gt;proxy&lt;/code&gt;, or both), whether replication is on it right now, whether it's up or down, and how many connections this Readyset adapter holds to it. &lt;code&gt;SHOW READYSET STATUS&lt;/code&gt; also has a new &lt;code&gt;CDC Server&lt;/code&gt; row.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="n"&gt;readyset&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;readyset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;upstream_servers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="c1"&gt;-----------+------+----------+------+--------+------------+------------+--------+------------+-------------------------------+-------------+&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;host&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;database&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;user&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;weight&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;purpose&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;active_cdc&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;health&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;down_since&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;last_ok&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;connections&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="c1"&gt;-----------+------+----------+------+--------+------------+------------+--------+------------+-------------------------------+-------------+&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;127&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3401&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;cdc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;proxy&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="n"&gt;T12&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;062&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;127&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3402&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;cdc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;proxy&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="n"&gt;T12&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;373&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;127&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3403&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;cdc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;proxy&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="n"&gt;T12&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;062&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;127&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;3404&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;cdc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;proxy&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="n"&gt;T12&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;55&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;062&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;00&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="c1"&gt;-----------+------+----------+------+--------+------------+------------+--------+------------+-------------------------------+-------------+&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="k"&gt;rows&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;004&lt;/span&gt; &lt;span class="n"&gt;sec&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can change either list while Readyset is running, without stopping replication:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="n"&gt;READYSET&lt;/span&gt; &lt;span class="n"&gt;CHANGE&lt;/span&gt; &lt;span class="n"&gt;CDC&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="s1"&gt;'mysql://user:pass@replica-a:3306/db|60,mysql://user:pass@replica-d:3306/db'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="n"&gt;READYSET&lt;/span&gt; &lt;span class="n"&gt;CHANGE&lt;/span&gt; &lt;span class="n"&gt;UPSTREAM&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="s1"&gt;'mysql://user:pass@replica-a:3306/db,mysql://user:pass@replica-d:3306/db'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Readyset connects to each new server and runs the same checks as at startup before it accepts the list. If any check fails, it rejects the statement, and the old list stays. If replication's current server is still in the new list, replication carries on without a pause. If you removed it, Readyset moves replication to a server from the new list.&lt;/p&gt;

&lt;p&gt;The list is stored in Readyset's Authority, so it survives restarts. This has one side effect worth knowing: after the first start, Readyset reads the list from the Authority and ignores the command-line flag. Use &lt;code&gt;ALTER READYSET&lt;/code&gt; from then on.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens when the server Readyset replicates from fails?
&lt;/h2&gt;

&lt;p&gt;Replication is single server. Readyset will connect to the server with the highest weight as the preferred one. It will stay streaming CDC events from the server until a failure happens. When that server stops answering, Readyset retries it up to &lt;code&gt;--upstream-connect-retries&lt;/code&gt; times (3 by default). Each attempt is bounded by &lt;code&gt;--upstream-connect-timeout&lt;/code&gt; (5 seconds by default). Once the retries are exhausted, Readyset moves to the next server by weight and resumes from the last GTID it applied.&lt;/p&gt;

&lt;p&gt;GTIDs are what make this safe. A GTID names the same transaction on every server in the topology, so Readyset can ask the new server, "have you seen everything I've already applied?" and resume from exactly that point. No rows are lost or applied twice. This is also why a multi-server list requires GTIDs: a binlog file name and position only mean something on the server that wrote them. For more information about GTID, see &lt;a href="https://readyset.io/blog/introducing-mysql-gtid-support-and-zero-downtime-failover-in-readyset" rel="noopener noreferrer"&gt;Introducing MySQL GTID Support and Zero-Downtime Failover in Readyset&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Readyset doesn't fail back. If replication moves from &lt;code&gt;replica-a&lt;/code&gt; to &lt;code&gt;replica-b&lt;/code&gt;, it stays on &lt;code&gt;replica-b&lt;/code&gt; even after &lt;code&gt;replica-a&lt;/code&gt; recovers. To move back, either change the list or &lt;code&gt;STOP&lt;/code&gt; and &lt;code&gt;START&lt;/code&gt; replication.&lt;/p&gt;

&lt;p&gt;Snapshotting always uses the same server as replication. The snapshot records a position on the server it read from, and keeping both on one server means that position is always valid for the stream that follows. With a multi-server list, Readyset records that position as a GTID set from the start. If the server fails in the middle of a snapshot, Readyset starts the snapshot again on the next server. That's the same path Readyset already took for any snapshot error.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does Readyset spread queries across replicas?
&lt;/h2&gt;

&lt;p&gt;Queries Readyset sends upstream follow a round-robin algorithm, because here there are many connections to spread out rather than one stream.&lt;/p&gt;

&lt;p&gt;Each client session picks a server at random from the servers in &lt;code&gt;--upstream-db-url&lt;/code&gt; that are up, and keeps it until the client disconnects. Weight doesn't affect this choice. A shallow cache miss goes to that session's server, and so does any query Readyset doesn't cache. With 100 sessions over four servers, you'll see roughly 25 on each, give or take a few. That's normal for random picks, and &lt;code&gt;readyset.upstream_servers&lt;/code&gt; will show it.&lt;/p&gt;

&lt;p&gt;Shallow caches have their own background workers that refresh entries before they expire. Those workers also pick a server at random when they connect and again when they reconnect, so refresh traffic spreads across the pool too.&lt;/p&gt;

&lt;p&gt;When a session's server dies, Readyset closes the session and terminates the client. If it reconnects, it will get a new server connection. The dead server is marked down the first time a connection to it fails. After that, new sessions skip it, so only one connection pays the connect timeout. A background health check pings every server every 10 seconds (&lt;code&gt;--upstream-health-interval-secs&lt;/code&gt;) and marks servers down or up again. That catches a dead server even when no session happens to be using it, which is common in a large read pool.&lt;/p&gt;

&lt;p&gt;Two background tasks don't spread out: the row-level security catalog poller and the cache permission checker always use the highest-weight server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does this work with PostgreSQL?
&lt;/h2&gt;

&lt;p&gt;This release covers MySQL with GTIDs. PostgreSQL still takes a single server: a replication slot and its LSN belong to one server, and no position carries over to another. For PostgreSQL, and for moving to a server that isn't in your list, the manual steps in the &lt;a href="https://readyset.io/docs/reference/failover" rel="noopener noreferrer"&gt;failover docs&lt;/a&gt; still apply.&lt;/p&gt;

&lt;p&gt;Try it yourself, &lt;a href="https://github.com/readysettech/readyset/releases/tag/stable-261022" rel="noopener noreferrer"&gt;download Readyset here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>mysql</category>
      <category>product</category>
    </item>
    <item>
      <title>A TTL Cache Needs To Know the Query</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Thu, 29 Oct 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/a-ttl-cache-needs-to-know-the-query-35lk</link>
      <guid>https://dev.to/readyset/a-ttl-cache-needs-to-know-the-query-35lk</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7oijmfwlm43srpw2xg15.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7oijmfwlm43srpw2xg15.png" alt="A TTL Cache Needs To Know the Query" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Plenty of teams cache query results with a TTL. A few seconds of staleness is fine for their workload and since a TTL is easy to reason about, this becomes the default solution. The trouble however, is the primitive underneath. Cache-aside on Redis is the default way to cache SQL and it's built on a basic primitive, a simple key-value store that holds bytes. We hold the view that a SQL query cache should not only hold the results, but also &lt;em&gt;the query&lt;/em&gt; that generated them and preferably additional metadata. When running a cache under load, refreshing a hot key or deciding what to evict becomes infinitely easier if the cache is able to run the query again and reconstitute the cached results on demand.&lt;/p&gt;

&lt;p&gt;Since a TTL cache built on Redis or Memcached doesn't know what a query is, it can't re-run one to refresh a hot key, collapse a burst of misses into a single call, or differentiate a 900 ms result from a 2 ms one. That work is left up to your application.&lt;/p&gt;

&lt;p&gt;We've written before about &lt;a href="https://readyset.io/blog/dont-use-kv-stores" rel="noopener noreferrer"&gt;why key-value stores struggle to cache relational data&lt;/a&gt; when freshness is the goal. This piece covers the other case where some staleness is acceptable, and the cache still needs to know the query to hold up under load.&lt;/p&gt;

&lt;p&gt;A note on names. Readyset has two caching modes, which we used to call shallow and deep caching. We now call them &lt;strong&gt;pull-based&lt;/strong&gt; and &lt;strong&gt;push-based&lt;/strong&gt; caching, after how each one keeps results fresh. A pull-based cache pulls new results from the database on a schedule, while a push-based cache has every write pushed into the cached results as it happens. The products are the same, and earlier posts use the old names.&lt;/p&gt;

&lt;p&gt;Adding hardware is a harder way out than it used to be. Memory and storage are getting pulled toward AI workloads, prices are up, and some regions have no data center capacity left to sell. &lt;a href="https://readyset.io/blog/your-database-bill-is-climbing-faster-than-your-traffic" rel="noopener noreferrer"&gt;Database bills are climbing faster than traffic&lt;/a&gt;, so &lt;a href="https://readyset.io/case-studies/how-we-reached-43-million-qps-for-mysql-and-postgresql-workloads-on-a-single-readyset-node" rel="noopener noreferrer"&gt;getting more out of the database&lt;/a&gt; you already run is worth real engineering effort.&lt;/p&gt;

&lt;p&gt;All of this matters more every month. A growing share of the SQL hitting production databases is written by agents at runtime, and for those queries there's no read path to wrap at all. We'll come back to that at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a key-value store knows about your data
&lt;/h2&gt;

&lt;p&gt;Very little. Redis is very good at its job, it stores values under keys and serves them fast, but it doesn't know if a SQL query produced the value, which tables that query read, how long the query took to run, which session settings shaped it, or who is allowed to see it.&lt;/p&gt;

&lt;p&gt;A cache-aside implementation fills the gap in application code. Every read path in the application checks the cache, runs the query on a miss, serializes the result, and writes it back with a TTL. Each of those steps is a decision your team makes by hand, query by query.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fljqp95vsixp40gbal4vt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fljqp95vsixp40gbal4vt.png" alt="Comparison of cache-aside on a key-value store, where your application sits between Redis and the database and owns the cache logic, versus Readyset, which sits between your application and the database so SQL stays unchanged and Readyset handles misses and refresh" width="800" height="407"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A query cache starts from the query. Readyset sits between your application and the database, holds the SQL and a database connection, and can run a query on its own. That's the key difference: a cache that can run the query can refresh it, coalesce misses on it, and put a price on it for eviction, while a key-value store can only hold what you hand it.&lt;/p&gt;

&lt;p&gt;Outside databases, caching already works in this way. A reverse proxy like Varnish, or a CDN, keeps the URL, so it can refetch from the origin, serve a stale copy while it refreshes (HTTP's &lt;code&gt;stale-while-revalidate&lt;/code&gt;), and collapse a burst of misses into one origin request. Readyset's pull-based cache does the same for SQL.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Cache-aside on a key-value store&lt;/th&gt;
&lt;th&gt;Readyset pull-based cache&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What it stores&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Bytes your app serialized, under a key your app chose&lt;/td&gt;
&lt;td&gt;Query results, keyed by SQL, parameters, schema, and session settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Read path&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cache-aside code in every read: check, query on miss, serialize, write back&lt;/td&gt;
&lt;td&gt;Unchanged; the app sends SQL as before&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;On a miss&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Your app runs the query and fills the cache&lt;/td&gt;
&lt;td&gt;Readyset forwards the query to the database and fills the cache&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Refresh&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A job you build, since the store can't run a query&lt;/td&gt;
&lt;td&gt;Readyset re-runs the query in the background&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stampedes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A lock you build&lt;/td&gt;
&lt;td&gt;Concurrent misses collapse into one query&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Eviction&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;LRU or LFU, access patterns only&lt;/td&gt;
&lt;td&gt;Weighs size, query cost, and read frequency&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Session and tenant safety&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Only as good as your key design&lt;/td&gt;
&lt;td&gt;Session settings and security context are part of the key&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Where a TTL cache falls short
&lt;/h2&gt;

&lt;p&gt;We ran into each of the problems below while building Readyset's pull-based cache, which we &lt;a href="https://readyset.io/blog/readyset-shallow-cache" rel="noopener noreferrer"&gt;introduced earlier this year&lt;/a&gt; under the shallow cache name. The first four form a chain: fixing one exposes the next, so they have to be solved together. The last four show up in every TTL cache regardless. Every fix depends on something a key-value store doesn't have.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhgq7uahe9miqy7a9lh2m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhgq7uahe9miqy7a9lh2m.png" alt="Two-column map of TTL cache problems to what Readyset does: hot keys expire and p99 spikes maps to sliding TTL, hot keys never expire maps to background refresh, every reader triggers a refresh maps to one refresh in flight per key, one schedule wastes database time maps to adaptive refresh with a load cap; then stampedes map to request coalescing, LRU evicts expensive results maps to cost-aware eviction, a session gets another's result maps to session-aware cache keys, and revoked users still get data maps to a permission cache with RLS-aware keys" width="800" height="744"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Hot keys expire under load
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2Fd39f0c6f-4b84-4e2b-878d-ec0094f58b6d.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fcms.readyset.io%2Ffiles%2Fuploads%2Fd39f0c6f-4b84-4e2b-878d-ec0094f58b6d.gif" alt="TTL refresh animation" width="600" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A fixed TTL forces a specific tradeoff. To bound staleness, every entry expires at its deadline, including a hot key read thousands of times a second. When it expires, every request for that key misses and goes to the database until one repopulates the cache. Latency on that key goes from under a millisecond to tens or hundreds of milliseconds. The p50 looks fine. Users feel it at p99, and a page that runs several queries only needs one of them to miss.&lt;/p&gt;

&lt;p&gt;This is also one reason why hit rate is not always the right metric to watch. It averages over every request, and the requests that hurt are a tiny sliver, the ones that land on a hot key in the moments after it expires. A cache can report 99% hits while nearly all of its slowest responses come from a few misses. Because they cluster on your most popular keys, they cluster on your most popular pages. Watch p99 latency on cached queries instead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What teams do today:&lt;/strong&gt; accept the spikes, or lengthen the TTL and accept staler data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readyset:&lt;/strong&gt; the TTL counts from the last read, not from when the entry was created. A key your application keeps reading stays cached and its latency stays flat. Keys that go quiet, age out and free memory. &lt;em&gt;Uses: read tracking per cached result.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Hot keys that never expire go stale
&lt;/h3&gt;

&lt;p&gt;Sliding TTL fixes the spike but it opens a new gap. A key that's read constantly never expires, so it can sit in the cache indefinitely while its data changes underneath it. A refresh also takes time. The query runs as long as it did the first time, so it has to start early enough to finish before the result goes past its staleness limit. For a 900 ms query, that lead time is real.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What teams do today:&lt;/strong&gt; this problem only appears once expiry is sliding, which is why most TTL caches stay fixed and keep the spikes from problem 1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readyset:&lt;/strong&gt; while a key is still being read, Readyset re-runs its query against the database and swaps in the new result. A request that finds an entry due for refresh gets the cached value immediately and queues the key. All of it runs on Readyset's own internal workers, off the request path.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh1zw7j5yqgjxqga85am3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh1zw7j5yqgjxqga85am3.png" alt="Timeline of one hot key read constantly: a fixed TTL misses at every expiry and sends all readers to the database, while a sliding TTL with background refresh keeps readers hitting the cache as refresh runs in the background" width="799" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Refresh multiplies database load
&lt;/h3&gt;

&lt;p&gt;Once refresh exists, a hot key with thousands of readers can trigger thousands of refreshes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What teams do today:&lt;/strong&gt; nothing, because without refresh there's nothing to deduplicate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readyset:&lt;/strong&gt; one refresh per key is in flight at a time. A hot key results in a single database query no matter how many readers it has.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. One refresh schedule fits nobody
&lt;/h3&gt;

&lt;p&gt;Keys change at different rates. Some results move (i.e. they are updated) every few seconds, while others sit unchanged for days. Fine-tuning the TTL for caches to match its update rate is a manual process, and not to mention that it changes often. The result is a query that might get evicted out too soon, or a query that is constantly refreshed even though it's not being updated frequently in the database. A single schedule spends database capacity on data that hasn't moved and lets the volatile keys fall behind.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What teams do today:&lt;/strong&gt; pick one TTL for everything, usually tuned for the most volatile data, and pay for it in database load.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readyset:&lt;/strong&gt; each refreshed result is compared with the previous one. Keys that changed get refreshed sooner, keys that didn't get refreshed later, and a load limit caps how much refresh traffic the database sees at once. In our &lt;a href="https://readyset.io/blog/adaptive-cache" rel="noopener noreferrer"&gt;Adaptive Cache benchmarks&lt;/a&gt;, this cut p95 staleness by 97% compared with a straight TTL, for about 10% more refreshes. &lt;em&gt;Uses: each key's history of changes.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Misses arrive all at once
&lt;/h3&gt;

&lt;p&gt;Refresh covers keys already in the cache. A new or evicted key still starts cold, and if hundreds of requests ask for it in the same instant, they all run the same expensive query. That's a cache stampede.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What teams do today:&lt;/strong&gt; absorb it with database headroom, which is capacity paid for and idle most of the time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readyset:&lt;/strong&gt; concurrent misses on one key collapse into a single upstream query. The rest wait for that result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyd94deydvlwifs5fppyu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyd94deydvlwifs5fppyu.png" alt="Four concurrent requests for the same cold key: without coalescing all four miss and run the same expensive query against the database, while with Readyset the four misses collapse into one query and the rest wait for its result" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Eviction drops the wrong results
&lt;/h3&gt;

&lt;p&gt;LRU and LFU look only at access patterns. A 4 KB result counts the same as a 4 MB one, and a 900 ms analytical query the same as a 2 ms lookup. When memory fills, the store can throw out a result that took a second to compute to make room for one that takes two milliseconds. LRU was designed for memory pages, where every entry is the same size and costs the same to bring back. That assumption holds for a CPU or an operating system's page cache. It breaks for query results, where one entry can be a thousand times larger or slower to rebuild than its neighbor. Evicting by recency alone treats a 900 ms report and a 2 ms lookup as interchangeable, and they aren't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What teams do today:&lt;/strong&gt; add memory until eviction rarely happens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readyset:&lt;/strong&gt; every entry records its size and how long its query took on the database. At the memory limit, Readyset weighs those against how often the entry is read. A new result gets in only if it's worth more than what it would push out, so a burst of cheap one-off queries leaves your expensive results in place. &lt;em&gt;Uses: result size and query cost.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  7. The same query returns different answers
&lt;/h3&gt;

&lt;p&gt;The same SQL with the same parameters can return different results depending on the session. Character set and collation change how text compares and sorts. Timezone changes how timestamps come back. SQL mode decides what happens on division by zero or an invalid date. A key built from the query and its parameters ignores all of that, and a session gets a result meant for someone else's settings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What teams do today:&lt;/strong&gt; mostly nothing. It rarely shows up until two clients with different settings share a cache, and then it looks like a data bug.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readyset:&lt;/strong&gt; the key includes the statement, its parameters, the schema it resolves against, and the session settings that affect the result. A hit returns what the database would have sent to that session. Collation alone has plenty of edge cases; we wrote up &lt;a href="https://readyset.io/blog/collation-improvements-in-readyset" rel="noopener noreferrer"&gt;how Readyset handles them&lt;/a&gt;. &lt;em&gt;Uses: the session's settings, seen on the wire.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  8. The cache doesn't know who's asking
&lt;/h3&gt;

&lt;p&gt;A key-value store hands the value to anyone with the key, including a user whose access was revoked an hour ago. Under row-level security, the same SQL returns different rows for different users, which is why most caches skip it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On a key-value store:&lt;/strong&gt; permission checks in every read path and per-tenant key namespaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Readyset:&lt;/strong&gt; it checks each user's permissions when the query is first created, keeps it up to date by querying the database every 5 minutes, stores a local copy, and consults it before returning data. When it isn't sure, it forwards the query to the database. For RLS, it folds the security context, such as the user ID or a JWT claim, into the cache key. If it hits a policy it can't interpret, it doesn't cache that query. &lt;em&gt;Uses: the database user and security context behind each query.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What knowing the query makes possible
&lt;/h2&gt;

&lt;p&gt;Every fix above comes from the same place. Readyset sees each query on the wire, so it knows things about a cached result that a key-value store never will.&lt;/p&gt;

&lt;p&gt;The result is a cache that keeps p99 latency flat under load, while background workers keep results fresh at the right interval for each one. That's what a TTL cache was supposed to be. It needs the query to get there, and your application keeps sending SQL exactly as before.&lt;/p&gt;

&lt;h2&gt;
  
  
  What about Redis's own answers?
&lt;/h2&gt;

&lt;p&gt;The strongest evidence for this argument comes from Redis itself. It has shipped two products aimed at exactly this gap: one teaches Redis about SQL queries, and one keeps Redis in sync with the database. A company builds those because its customers keep running into the limits of a plain key-value store.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/redis-field-engineering/redis-smart-cache" rel="noopener noreferrer"&gt;Redis Smart Cache&lt;/a&gt;&lt;/strong&gt; wraps your JDBC driver and caches SQL results in Redis without code changes. It records access frequency and mean query time, and caching is driven by rules you configure per query. Because it's a JDBC wrapper, it covers JVM applications; a Python, Node, Go, or Ruby service needs something else. Freshness is still rule-based TTL on top of Redis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://redis.io/docs/latest/integrate/redis-data-integration/architecture/" rel="noopener noreferrer"&gt;Redis Data Integration&lt;/a&gt;&lt;/strong&gt; (RDI) uses change data capture to copy rows from your database into Redis hashes or JSON documents, typically within seconds. That keeps rows fresh, but it replicates tables, not query results. Your application now reads a Redis data model instead of sending SQL, so joins, filters, and aggregates move into application code or pipeline transforms. Per &lt;a href="https://redis.io/docs/latest/operate/rc/rdi/" rel="noopener noreferrer"&gt;Redis Cloud's docs&lt;/a&gt;, it assumes the app can tolerate eventual consistency.&lt;/p&gt;

&lt;p&gt;Readyset takes the third path: keep the SQL, keep your driver in any language, and put the query-aware work in a proxy between the application and the database.&lt;/p&gt;

&lt;h2&gt;
  
  
  When a few seconds of staleness is too much
&lt;/h2&gt;

&lt;p&gt;Some workloads can't accept any staleness. For those, Readyset has a second mode: push-based caching. Instead of pulling fresh results from the database on a schedule, it pushes each write into the cached results as it happens. It's built on Noria, a dataflow system developed at MIT and presented at OSDI '18.&lt;/p&gt;

&lt;p&gt;When you cache a query, Readyset turns it into a graph of SQL operators ending in a node that holds the result set. It follows the database's replication stream and turns each &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt; into a delta that flows through the graph. Each operator touches only the affected rows, and the cached results change in place. The graph holds only the keys your application has asked for.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fje9bkaiexmjpd355dctp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fje9bkaiexmjpd355dctp.png" alt="Push-based caching dataflow: the replication stream feeds the orders table through a filter and the users table into a join, ending at a reader node that holds the cached results, which application reads look up; each INSERT, UPDATE, and DELETE becomes a delta that touches only the affected rows" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There's no invalidation logic to write and no TTL to tune. Write-heavy tables stay cached too, since each write costs only the rows it touched. And unlike row-level CDC into a key-value store, what stays fresh is the query result itself, joins and aggregates included.&lt;/p&gt;

&lt;p&gt;For more on this mode, see &lt;a href="https://readyset.io/blog/dont-use-kv-stores" rel="noopener noreferrer"&gt;Don't use key-value stores to cache from relational databases&lt;/a&gt; and &lt;a href="https://readyset.io/blog/cache-invalidation-sql-queries" rel="noopener noreferrer"&gt;Cache invalidation for SQL queries&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents make the case stronger
&lt;/h2&gt;

&lt;p&gt;Everything above assumes a person wrote the read path. That assumption is fading. A growing share of the SQL hitting production databases is written by agents at runtime, and that changes caching in four ways.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cache-aside has nothing to wrap.&lt;/strong&gt; Cache-aside works by putting cache code around a read path a developer wrote. An agent's query doesn't exist until the model writes it, so there's no function to wrap and no place to put the check, the miss handling or the key design. Only a cache that sees the SQL itself can cache an agent's reads at all. For agent traffic, the query is the only thing there is, which is the argument of this piece taken to its end.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0k889w4vmh5pgg67bl3e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0k889w4vmh5pgg67bl3e.png" alt="In an app written by engineers, cache-aside code wraps each read path like getOrders, getUser, and topProducts, and the query set changes at release speed; with an agent, new SQL is written each prompt so there is no read path to wrap and the cache has to sit where the SQL arrives, between the agent and the database" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nobody can pick the hot queries in advance.&lt;/strong&gt; In an app written by people, the set of read paths changes at release speed, and someone can keep the cache list roughly current. Agent queries change with every prompt. The workable way to decide what to cache is to watch live traffic and rank queries by the load they put on the database, which is what QueryPilot does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent traffic has the shape that breaks naive caches.&lt;/strong&gt; Agents fan out: parallel sub-agents and concurrent sessions often ask for the same data at the same moment, which is a stampede by another name. They also explore, firing off one-off queries that would flush an LRU cache of the expensive results everyone else depends on. Request coalescing and cost-aware eviction were built for exactly these patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A wrong answer becomes a wrong action.&lt;/strong&gt; A person looking at a slightly stale dashboard usually notices. An agent takes the stale number, acts on it, and hands it to the next step. The session and permission problems get sharper the same way: an agent acting for one user that receives another user's cached rows is a data leak with no person in the loop to catch it. Session-aware keys, RLS-aware keys and permission checks become requirements. For reads that drive actions, push-based caching keeps results current as writes arrive; pull-based caching covers exploratory reads where a few seconds of staleness is fine.&lt;/p&gt;

&lt;p&gt;This is also where database load is heading. Agents don't wait for a page to render or log off at night, and their query volume grows with the number of agents, not the number of users. With hardware scarce, that load has to come off the database somewhere, and a cache that knows the query is the only kind that can take it.&lt;/p&gt;

&lt;p&gt;We'll be honest about what we don't know yet, how cacheable agent SQL is in practice. Our internal tests indicate that it's very repetitive. About 40% of queries are duplicates and cacheable in agentic workloads as per our internal testing. Many agents run the same playbooks at the same time, so they ask for the same data with different parameters. Many don't write free-form SQL at all; they call tools that wrap fixed queries. And agents break big tasks into many small follow-up lookups, which repeat far more often than one-off reports. The open question is free-form text-to-SQL, where two agents can ask the same question in differently shaped SQL. We've started tagging agent traffic in our proxy to measure this, and we'll publish what we find.&lt;/p&gt;

&lt;h2&gt;
  
  
  One connection string
&lt;/h2&gt;

&lt;p&gt;Both modes sit behind the MySQL and PostgreSQL wire protocols (&lt;a href="https://readyset.io/blog/what-is-a-wire-compatible-sql-caching-proxy" rel="noopener noreferrer"&gt;here's how a wire-compatible caching proxy works&lt;/a&gt;). Making an application cache-aware usually means building against a cache API and rewriting every read path; we've seen teams spend six months to a year on that work. With Readyset, it's a connection string change, in any language.&lt;/p&gt;

&lt;p&gt;Keep Redis for sessions, counters, and queues. For query results, use a cache that knows what a query is.&lt;/p&gt;

&lt;p&gt;Try it at &lt;a href="https://readyset.io/downloads" rel="noopener noreferrer"&gt;readyset.io&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>engineering</category>
    </item>
    <item>
      <title>Black October: What Actually Happened, and What To Patch</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Tue, 27 Oct 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/black-october-what-actually-happened-and-what-to-patch-556k</link>
      <guid>https://dev.to/readyset/black-october-what-actually-happened-and-what-to-patch-556k</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxuznwwjawvmj7f942l4g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxuznwwjawvmj7f942l4g.png" alt="Black October: What Actually Happened, and What To Patch" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Black October is the name social media gave to a wave of security disclosures in October 2026, including PHP2Shell, the Railway and TiDB Cloud breaches, and the LiteLLM supply-chain attack.&lt;/p&gt;

&lt;p&gt;Most of the "AI is hacking the internet" stories are about AI finding bugs, not exploiting them. The breaches that hurt database teams came from long-lived credentials stored in shared places. Here's what we found and what to do this week.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Most of the AI in this story works for defenders.&lt;/strong&gt; Vulnerability disclosures doubled this year, and AI tools found the most serious bug on the list before it was widely exploited.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI-driven attacks are real but rare.&lt;/strong&gt; Only two of the 28 incidents involve an AI-driven attack, and the evidence for one of them is weak.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stolen credentials did the real damage.&lt;/strong&gt; Railway, Zeabur, TiDB Cloud, and LiteLLM all came down to long-lived keys stored in one place.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your next step:&lt;/strong&gt; Patch the software next to your database, and rotate any database credential stored in a platform's environment variables.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What was Black October?
&lt;/h2&gt;

&lt;p&gt;Black October was a burst of alarm in mid-October 2026, when a list of 28 security incidents spread on Reddit and X. One post said AI agent swarms were hacking about half the internet. Another said a new CVE (Common Vulnerabilities and Exposures entry) was dropping every hour.&lt;/p&gt;

&lt;p&gt;The panic follows a familiar plot. In The Hunt for Red October (1990), the Soviet Union launches a new submarine with a drive so quiet that sonar can barely hear it. When it heads for the US coast, both governments assume its captain, Marko Ramius, plans to attack. One analyst, Jack Ryan, reads the same evidence and reaches the opposite conclusion: Ramius is defecting and bringing the submarine to the West.&lt;/p&gt;

&lt;p&gt;Black October has the same shape. A powerful new capability, AI that finds software flaws at scale, showed up all at once, and the first reading was that it was being turned against everyone. The evidence mostly points the other way. Like Red October, the alarming new arrival is largely on the defenders' side. The damage this month came from something older and quieter.&lt;/p&gt;

&lt;p&gt;We took Ryan's approach. We checked each incident against primary sources and sorted it by what AI actually did. Then we searched security news for critical incidents that the list missed. We build &lt;a href="https://readyset.io/downloads" rel="noopener noreferrer"&gt;Readyset&lt;/a&gt;, a SQL proxy that sits between applications and Postgres or MySQL, so we focused on those databases and the credentials that reach them.&lt;/p&gt;

&lt;h2&gt;
  
  
  How many of the 28 incidents actually involved AI?
&lt;/h2&gt;

&lt;p&gt;Nine of the 28 incidents have a documented or possible AI connection, and none was traced to AI-written code. The other 19 have no documented AI link. &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkrgxxm7e7q5ne3o9x3s2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkrgxxm7e7q5ne3o9x3s2.png" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Readyset review of 28 incidents from the viral Reddit list, primary sources, as of October 22, 2026 (full table in the appendix)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The sources show two more patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Some of it is old news.&lt;/strong&gt; The Medi-Cal billing-vendor breach happened in October 2025. The AOMEI update tampering ran from May through July. Palo Alto patched its GlobalProtect bug in May, and the North Korean campaign started in July 2025. &lt;a href="https://www.securitytoday.de/en/2026/10/22/black-october-many-attacks-had-been-running-for-months/" rel="noopener noreferrer"&gt;SecurityToday&lt;/a&gt; found that many of the attacks began weeks or months earlier.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Some numbers grew in the retelling.&lt;/strong&gt; eMudhra's "master keys" were eight intermediate certificates that never issued a website certificate. Railway said an attacker "may have" reached customer secrets. Zeabur's 321,810 figure counts account records read from a database, not accounts taken over. Cairn's "100+ companies" is an estimate based on token spending.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The closest case of AI-written code isn't on the list. &lt;a href="https://www.bleepingcomputer.com/news/security/misconfigured-supabase-apps-expose-data-in-over-16-000-databases/" rel="noopener noreferrer"&gt;UpGuard found&lt;/a&gt; more than 16,000 misconfigured Supabase databases, most with row-level security turned off. UpGuard attributes most of them to apps built with AI coding agents, but says its scan can't prove that for any single site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is AI really finding more bugs?
&lt;/h2&gt;

&lt;p&gt;Yes. AI tools got very good at finding bugs this year, and defenders use them the most.&lt;/p&gt;

&lt;p&gt;One scene in the film captures what that feels like. Red October's quiet drive confuses the US sonar computer, which logs it as "magma displacement," a natural sound. Sonar operator Seaman Jones plays the recording 10 times faster and hears a machine. Better sensors put more contacts on the screen, and the work becomes telling them apart. That's where the security industry is now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Disclosures doubled.&lt;/strong&gt; The US National Vulnerability Database (NVD) logged &lt;a href="https://github.com/jgamblin/monthlyCVEStats/releases/tag/cve-update-September-2026" rel="noopener noreferrer"&gt;72,812 CVEs from January through September&lt;/a&gt;, more than in all of 2025. September alone had 14,943, compared to 4,321 a year earlier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI found the most serious bug on the list.&lt;/strong&gt; PHP2Shell lets an unauthenticated attacker run code on any web server that runs PHP, through code that dates back to 2012. Calif and Wiz each found it, both using the same OpenAI model. OpenAI says &lt;a href="https://decrypt.co/381567/who-found-php-bug-governments-unplug-websites-chatgpt" rel="noopener noreferrer"&gt;AI found it before attackers did&lt;/a&gt;. But Amazon's honeypots logged an exploit attempt four days before disclosure, and a leak forced the patch out a day early.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI tools appear in vulnerability credits.&lt;/strong&gt; The &lt;a href="https://nodejs.org/en/blog/vulnerability/october-2026-security-releases" rel="noopener noreferrer"&gt;Node.js Brotli fix&lt;/a&gt; credits OpenAI Codex Security. Microsoft's &lt;a href="https://www.bleepingcomputer.com/news/microsoft/microsoft-october-2026-patch-tuesday-fixes-1-411-flaws-3-zero-days/" rel="noopener noreferrer"&gt;October Patch Tuesday&lt;/a&gt; fixed about 1,411 flaws, a record that the press links to Microsoft's own AI bug hunting. Anthropic's &lt;a href="https://red.anthropic.com/2026/cvd/" rel="noopener noreferrer"&gt;disclosure dashboard&lt;/a&gt; lists 219 CVEs and 365 GitHub security advisories.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attackers use few of these bugs.&lt;/strong&gt; &lt;a href="https://www.vulncheck.com/blog/anthropic-glasswing-receipts" rel="noopener noreferrer"&gt;VulnCheck counted&lt;/a&gt; 225 CVEs credited to Anthropic's program as of late September. Attackers have exploited one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Maintainers carry the cost. &lt;a href="https://www.theregister.com/databases/2026/10/16/postgres-19-delayed-after-ai-reviewers-find-more-bugs-than-humans-can-fix/5303471" rel="noopener noreferrer"&gt;PostgreSQL 19 moved to November 19&lt;/a&gt; and dropped several major features. The project cites the volume of fixes to older branches, and press coverage ties that volume to AI-assisted code review. &lt;a href="https://www.theregister.com/security/2026/10/20/swamped-curl-maintainers-take-low-level-flaws-public-to-survive-vulnerability-avalanche/5304198" rel="noopener noreferrer"&gt;curl will publish&lt;/a&gt; low- and medium-severity reports openly starting October 26 because its maintainers can't keep up.&lt;/p&gt;

&lt;p&gt;If you run Postgres or MySQL, patch on a tighter schedule than you did a year ago. &lt;a href="https://www.rapid7.com/blog/post/tr-q3-2026-threat-update-attackers-exploiting-vulnerabilities-within-3-days/" rel="noopener noreferrer"&gt;Rapid7 reports&lt;/a&gt; that attackers now exploit high-severity bugs about three days after disclosure, on average.&lt;/p&gt;

&lt;h2&gt;
  
  
  Have AI agents actually run attacks?
&lt;/h2&gt;

&lt;p&gt;Yes, but the confirmed cases are fewer, and stranger, than the X posts suggest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A lab's own agents caused the Hugging Face incident.&lt;/strong&gt; The "swarm" that people cite came from OpenAI's test environment. According to &lt;a href="https://openai.com/index/hugging-face-model-evaluation-security-incident/" rel="noopener noreferrer"&gt;OpenAI&lt;/a&gt;, agents running a hacking benchmark with reduced safeguards couldn't solve some tasks and went looking for answers. They broke into OpenAI's own artifact server first, then reached Hugging Face in July. About 1,200 agents were involved. In May, agents that OpenAI was testing also &lt;a href="https://www.theregister.com/security/2026/09/14/openais-malicious-bot-swarm-attacked-rubygems/5296356" rel="noopener noreferrer"&gt;pushed malicious packages to RubyGems&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Criminals use agents to scale up.&lt;/strong&gt; In the &lt;a href="https://thenextweb.com/news/ai-agents-hacker-cairn-100-sites-deere-norforge" rel="noopener noreferrer"&gt;Cairn campaign&lt;/a&gt;, attackers aimed an open-source multi-agent platform at more than 1,200 websites. The agents tried to plant web shells, which are scripts that give an attacker remote control of a server. Reuters named Deere, SharkNinja, and Cummins among the targets, and each reported limited impact. The attackers also left their own control panels exposed, leaking hundreds of credentials. Anthropic's &lt;a href="https://www.anthropic.com/threat-intelligence-report-september-2026" rel="noopener noreferrer"&gt;September threat report&lt;/a&gt; describes one group running Claude Code workflows with little human input, and another that scanned 1.8 million Android apps for hard-coded secrets.&lt;/p&gt;

&lt;p&gt;These agents went after known web bugs and exposed secrets. They didn't invent new kinds of attacks. They made old attacks cheap enough to run against everyone at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where did the real damage come from?
&lt;/h2&gt;

&lt;p&gt;The incidents that hurt database teams this month share a pattern: one long-lived credential, stored in one place, that opened many systems. The weak spots were systems nobody watches closely: the platform that stores your environment variables, your CI/CD (continuous integration and delivery) server, a vendor's control plane, or a laptop with a &lt;code&gt;.env&lt;/code&gt; file.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Incident&lt;/th&gt;
&lt;th&gt;How attackers got in&lt;/th&gt;
&lt;th&gt;What they could reach&lt;/th&gt;
&lt;th&gt;Time inside&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.pingcap.com/trust-hub/security/security-update-october-2026/" rel="noopener noreferrer"&gt;TiDB Cloud&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;A stolen service-account credential&lt;/td&gt;
&lt;td&gt;Account data, SQL editor text, and encrypted management API keys&lt;/td&gt;
&lt;td&gt;About four weeks (Sep 9-Oct 7)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://zeabur.com/zh-TW/blogs/october-2026-security-incident" rel="noopener noreferrer"&gt;Zeabur&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Leaked long-lived AWS keys and a cluster admin token that never expired&lt;/td&gt;
&lt;td&gt;3.2 million environment-variable records and possible access to 865 database services&lt;/td&gt;
&lt;td&gt;Oct 14-15, its second breach since August&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://blog.railway.com/p/security-disclosure-wednesday-october-21st" rel="noopener noreferrer"&gt;Railway&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Not disclosed&lt;/td&gt;
&lt;td&gt;Customer environment variables, which can include database credentials; some were decrypted&lt;/td&gt;
&lt;td&gt;Detected Oct 21&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://thehackernews.com/2026/10/litellm-compromised-in-supply-chain.html" rel="noopener noreferrer"&gt;LiteLLM&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;GitHub CLI tokens stolen from three engineers&lt;/td&gt;
&lt;td&gt;A stealer that took &lt;code&gt;.env&lt;/code&gt; files, &lt;code&gt;psql&lt;/code&gt; and &lt;code&gt;mysql&lt;/code&gt; shell history, and keys found through &lt;code&gt;DATABASE_URL&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;About two hours live on PyPI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://patchstack.com/articles/updraftcentral-key-compromise-wordpress-backdoors/" rel="noopener noreferrer"&gt;UpdraftPlus&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;A breach of the vendor's own website&lt;/td&gt;
&lt;td&gt;Connection keys to customer WordPress sites that never expire&lt;/td&gt;
&lt;td&gt;Oct 18-19&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.securityweek.com/hijacked-developer-account-used-to-plant-stealer-in-ovhcloud-cli/" rel="noopener noreferrer"&gt;OVHcloud CLI&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;A contributor's GitHub account, compromised since March&lt;/td&gt;
&lt;td&gt;Release files for five versions of the tool&lt;/td&gt;
&lt;td&gt;About 94 minutes of bad downloads&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgimhglx7jysu1mbus1bm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgimhglx7jysu1mbus1bm.png" width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The pattern shared by the Railway, Zeabur, TiDB Cloud, and UpdraftPlus incidents&lt;/p&gt;

&lt;p&gt;Zeabur's own report says its admin credentials were long-lived, stored in plain text, and usable from the public internet. Railway says its incident is one of a series aimed at hosting platforms, with AI inference providers as the final target. A researcher traced cryptocurrency thefts that used keys stored on Railway to about two hours before Railway's disclosure.&lt;/p&gt;

&lt;p&gt;TiDB Cloud matters most to us because it's a managed MySQL-compatible database. PingCAP found no sign that the attacker touched data inside customer databases, and it hasn't asked customers to change database passwords. But the attacker did get text that people typed into the web SQL editor. If anyone on your team pasted a connection string or password into a hosted SQL console, assume that someone else has it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should you patch and rotate this week?
&lt;/h2&gt;

&lt;p&gt;Patch PgBouncer, your database, and the app-tier software next to it, then rotate every database credential stored in a platform's environment variables. The details follow.&lt;/p&gt;

&lt;h3&gt;
  
  
  Patch these components
&lt;/h3&gt;

&lt;p&gt;The list starts with the database tier.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Update to&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.postgresql.org/about/news/pgbouncer-1261-released-fixes-three-cves-3403/" rel="noopener noreferrer"&gt;PgBouncer&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;1.26.1&lt;/td&gt;
&lt;td&gt;A client with one user's password can sign in as any other user that uses SCRAM password authentication, including superusers. Two other bugs let an unauthenticated client freeze it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.oracle.com/security-alerts/cpuoct2026.html" rel="noopener noreferrer"&gt;MySQL&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;October Critical Patch Update (8.4.13 for the 8.4 line)&lt;/td&gt;
&lt;td&gt;Quarterly MySQL fixes; version 8.4 is affected through 8.4.12&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://mariadb.com/docs/server/security/cve/community-server" rel="noopener noreferrer"&gt;MariaDB&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;10.6.28, 10.11.19, 11.4.13, 11.8.9, or 12.3.3&lt;/td&gt;
&lt;td&gt;MariaDB published 15 CVEs on October 9 and 16, including three rated 9.9. The fixes shipped in the summer releases, so confirm that you have them.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.postgresql.org/about/news/pgvector-087-released-3392/" rel="noopener noreferrer"&gt;pgvector&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;0.8.7&lt;/td&gt;
&lt;td&gt;Buffer overflow when it builds IVFFlat indexes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://jdbc.postgresql.org/security/" rel="noopener noreferrer"&gt;PgJDBC&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;42.7.14&lt;/td&gt;
&lt;td&gt;Two CVEs in the Java driver&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.postgresql.org/about/news/postgresql-186-1711-1615-1519-1424-and-19-beta-3-released-3365/" rel="noopener noreferrer"&gt;PostgreSQL&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;18.6, 17.11, 16.15, 15.19, or 14.24&lt;/td&gt;
&lt;td&gt;No October release, but the August release fixed 28 CVEs. If you skipped it, update before the November release.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://cert.europa.eu/publications/security-advisories/2026-018/" rel="noopener noreferrer"&gt;PHP&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;8.5.12, 8.4.27, 8.3.36, or 8.2.35&lt;/td&gt;
&lt;td&gt;PHP2Shell lets attackers run code on the app servers that hold your database credentials.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://docs.gitlab.com/releases/patches/patch-release-gitlab-19-5-1-released/" rel="noopener noreferrer"&gt;GitLab&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;19.5.1 or its backports&lt;/td&gt;
&lt;td&gt;Two bugs rated 10 out of 10. CI/CD variables often hold production database credentials.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://nodejs.org/en/blog/vulnerability/october-2026-security-releases" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;22.23.4, 24.22.1, or 26.12.1&lt;/td&gt;
&lt;td&gt;Brotli decoder bug, plus fixes for TLS hostname checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://bleepingcomputer.com/news/security/f5-releases-out-of-band-patches-for-critical-nginx-vulnerabilities" rel="noopener noreferrer"&gt;NGINX&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;1.31.7 or 1.30.6&lt;/td&gt;
&lt;td&gt;Three memory bugs, each needing a specific configuration (alias, AIO with SSI, or a regex map)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If any computer installed LiteLLM 1.107.0 on October 21, treat it as compromised. Rotate every credential it could read, including database passwords.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reduce credential risk
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Rotate every database credential that you've stored in a hosting platform's environment variables, a CI/CD system, or a hosted SQL console.&lt;/li&gt;
&lt;li&gt;Switch to short-lived credentials where your platform supports them, such as cloud identity and access management (IAM) database authentication or dynamic secrets from a vault.&lt;/li&gt;
&lt;li&gt;Create a separate database user for each service and each AI agent, with only the access it needs. Don't let agents use the application's sign-in. The same goes for any proxy in the path: Readyset, PgBouncer, or ProxySQL should each connect with its own user, not the application's.&lt;/li&gt;
&lt;li&gt;Block public internet access to your database, and require TLS.&lt;/li&gt;
&lt;li&gt;Turn on audit logging for your database and for any control plane that manages it.&lt;/li&gt;
&lt;li&gt;Store backups offsite, and make them immutable. The &lt;a href="https://www.cisa.gov/news-events/cybersecurity-advisories/aa26-293a" rel="noopener noreferrer"&gt;SafePay advisory&lt;/a&gt; describes attackers resetting backup appliances and deleting backups before they encrypt data.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Per-agent database users get hard to manage once you have more than a few agents. That's the problem we're building Readyset Guard to solve: it applies per-agent access policies at the proxy, so each agent gets only the queries and data it should.&lt;/p&gt;

&lt;h2&gt;
  
  
  One ping only
&lt;/h2&gt;

&lt;p&gt;The film ends well because Ryan read the evidence instead of the noise. Near the end, Ramius asks for "one ping only": a single sonar pulse that shows exactly where he is after hours of guessing on both sides.&lt;/p&gt;

&lt;p&gt;That's the standard we'd hold this month's coverage to. The AI story is mostly good news: AI is finding old bugs faster than attackers, and patches are shipping. The part that cost people data and money was quieter. It came in through keys that had sat in the same place for months.&lt;/p&gt;

&lt;p&gt;Patch what sits next to your database, and spend an afternoon on the systems nobody watches. You'll learn more there than from the news feed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Appendix: All 28 incidents
&lt;/h2&gt;

&lt;p&gt;We checked each incident against primary sources where they exist. Relevance means relevance to teams that run Postgres or MySQL.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Incident&lt;/th&gt;
&lt;th&gt;When&lt;/th&gt;
&lt;th&gt;What AI did&lt;/th&gt;
&lt;th&gt;Relevance&lt;/th&gt;
&lt;th&gt;What the list got wrong&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cert.europa.eu/publications/security-advisories/2026-018/" rel="noopener noreferrer"&gt;PHP2Shell&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Fixed Oct 21&lt;/td&gt;
&lt;td&gt;Found the bug&lt;/td&gt;
&lt;td&gt;Medium-high&lt;/td&gt;
&lt;td&gt;Understated it. "70%" is PHP's share of websites, not the share that's vulnerable.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;a href="https://thehackernews.com/2026/10/eight-emudhra-ca-keys-compromised.html" rel="noopener noreferrer"&gt;eMudhra&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 20&lt;/td&gt;
&lt;td&gt;Found it (weak link)&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Intermediate keys, not root keys. None issued a website certificate.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.cde.ca.gov/nr/in/ets-notification.asp" rel="noopener noreferrer"&gt;California students&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Access May-Sep; notice Oct 19&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;The breach was at ETS, the testing vendor.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;a href="https://blog.railway.com/p/security-disclosure-wednesday-october-21st" rel="noopener noreferrer"&gt;Railway&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 21&lt;/td&gt;
&lt;td&gt;AI keys targeted&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Railway says "may have accessed" and gives no count.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;&lt;a href="https://zeabur.com/zh-TW/blogs/october-2026-security-incident" rel="noopener noreferrer"&gt;Zeabur&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 14-17&lt;/td&gt;
&lt;td&gt;AI keys targeted&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Counted 321,810 records read, not accounts taken over.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.stepsecurity.io/blog/litellm-1-107-0-compromised-pypi-backdoored-wheels-credential-stealer" rel="noopener noreferrer"&gt;LiteLLM&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 21&lt;/td&gt;
&lt;td&gt;AI tool compromised&lt;/td&gt;
&lt;td&gt;Medium-high&lt;/td&gt;
&lt;td&gt;The bad release was live for about two hours.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;&lt;a href="https://docs.gitlab.com/releases/patches/patch-release-gitlab-19-5-1-released/" rel="noopener noreferrer"&gt;GitLab&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 12 and 21&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Merged two separate bugs rated 10 out of 10 into one.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;&lt;a href="https://thenextweb.com/news/ai-agents-hacker-cairn-100-sites-deere-norforge" rel="noopener noreferrer"&gt;Cairn&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Sep 25-Oct 19&lt;/td&gt;
&lt;td&gt;Agents ran the attack&lt;/td&gt;
&lt;td&gt;Medium-high&lt;/td&gt;
&lt;td&gt;"100+" is an estimate based on token spending.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;&lt;a href="https://bleepingcomputer.com/news/security/retail-giant-ahold-delhaize-takes-systems-offline-after-cyberattack" rel="noopener noreferrer"&gt;Ahold Delhaize&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 11-12&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;The company took systems offline itself, and stores stayed open.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.onamae.com/news/article/11584" rel="noopener noreferrer"&gt;Onamae.com&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 20-21&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;One VPS product. 26,739 servers were possibly affected.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;&lt;a href="https://securityaffairs.com/201490/security/signal-vulnerability-could-keep-calls-alive-after-users-hang-up.html" rel="noopener noreferrer"&gt;Signal&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Fixed Sep; CVE Oct 20&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;A malicious caller has to trigger it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;&lt;a href="https://bleepingcomputer.com/news/security/f5-releases-out-of-band-patches-for-critical-nginx-vulnerabilities" rel="noopener noreferrer"&gt;NGINX&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 14&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium-high&lt;/td&gt;
&lt;td&gt;Rated 8.1 under CVSS 3.1. Each bug needs a non-default configuration.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;&lt;a href="https://thehackernews.com/2026/10/new-qpack-flaws-can-crash-http3-servers.html" rel="noopener noreferrer"&gt;HTTP/3 QPACK&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 22&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Affects HTTP/3 libraries, not mainstream web servers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;&lt;a href="https://thehackernews.com/2026/10/hackers-exploit-plex2shell-flaws-to.html" rel="noopener noreferrer"&gt;Plex&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Exploited from Oct 17&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Patched in August. Only unpatched servers are at risk.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.cisa.gov/news-events/cybersecurity-advisories/aa26-293a" rel="noopener noreferrer"&gt;SafePay&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 20&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;600+ victims, but not all are critical infrastructure.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;&lt;a href="https://unit42.paloaltonetworks.com/active-exploitation-of-pan-os-cve-2026-0257/" rel="noopener noreferrer"&gt;Palo Alto GlobalProtect&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Bug from May; update Oct 19&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium-high&lt;/td&gt;
&lt;td&gt;An old bug with a new ransomware attribution.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.bleepingcomputer.com/news/security/bullhorn-takes-staffing-platform-offline-to-contain-cyberattack/" rel="noopener noreferrer"&gt;Bullhorn&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 16-19&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low-medium&lt;/td&gt;
&lt;td&gt;Accurate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;18&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.securityweek.com/970000-medi-cal-members-affected-by-paradigm-healthcare-data-breach/" rel="noopener noreferrer"&gt;Medi-Cal&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Breach Oct 2025&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low-medium&lt;/td&gt;
&lt;td&gt;A billing vendor, and a year old&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;19&lt;/td&gt;
&lt;td&gt;&lt;a href="https://patchstack.com/articles/updraftcentral-key-compromise-wordpress-backdoors/" rel="noopener noreferrer"&gt;UpdraftPlus (WordPress)&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 18-19&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Accurate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;&lt;a href="https://thehackernews.com/2026/10/attackers-tampered-with-aomei.html" rel="noopener noreferrer"&gt;AOMEI&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;May-Jul; disclosed Oct 16&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Months old&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;21&lt;/td&gt;
&lt;td&gt;&lt;a href="https://cybersecuritynews.com/meta-muse-ai-privacy-flaw/" rel="noopener noreferrer"&gt;Meta Muse&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 20-21&lt;/td&gt;
&lt;td&gt;AI product leaked data&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Shared chats only. No misuse seen.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;&lt;a href="https://kaba.cx/posts/20261020_Tor/" rel="noopener noreferrer"&gt;Tor relays&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Aug-Oct 20&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low-medium&lt;/td&gt;
&lt;td&gt;Hacked exit relays stole SSH passwords, not general sign-ins.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;23&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.pingcap.com/trust-hub/security/security-update-october-2026/" rel="noopener noreferrer"&gt;TiDB Cloud&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Sep 9-Oct 19&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;The attacker's 10.6 TB and 180,000-organization claims are unconfirmed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;24&lt;/td&gt;
&lt;td&gt;&lt;a href="https://thehackernews.com/2026/10/state-bank-of-india-confirms-data-leak.html" rel="noopener noreferrer"&gt;State Bank of India&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 21&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;3,897 records confirmed. SBI hasn't confirmed a breach of its systems.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.securityweek.com/hijacked-developer-account-used-to-plant-stealer-in-ovhcloud-cli/" rel="noopener noreferrer"&gt;OVHcloud CLI&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 19&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Accurate, but nobody has analyzed the payload.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;26&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.securityweek.com/siemens-software-center-vulnerability-exploited-in-clickfix-malware-attacks/" rel="noopener noreferrer"&gt;Siemens Software Center&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 15-19&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;An installer app, not industrial systems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;27&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.bleepingcomputer.com/news/security/lazarus-hackers-use-post-quantum-cryptography-for-malware-delivery/" rel="noopener noreferrer"&gt;North Korea (Lazarus)&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Since Jul 2025; Oct 21&lt;/td&gt;
&lt;td&gt;Attack (weak link)&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;Not new. The AI link is one generated photo.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;28&lt;/td&gt;
&lt;td&gt;&lt;a href="https://nodejs.org/en/blog/vulnerability/october-2026-security-releases" rel="noopener noreferrer"&gt;Node.js Brotli&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 21&lt;/td&gt;
&lt;td&gt;Found the bug&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;td&gt;Code execution was shown only on a weakened build.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  What the list missed
&lt;/h3&gt;

&lt;p&gt;Database and credential items come first.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Incident&lt;/th&gt;
&lt;th&gt;When&lt;/th&gt;
&lt;th&gt;What AI did&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.postgresql.org/about/news/pgbouncer-1261-released-fixes-three-cves-3403/" rel="noopener noreferrer"&gt;PgBouncer SCRAM bypass&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 14&lt;/td&gt;
&lt;td&gt;None stated&lt;/td&gt;
&lt;td&gt;Lets a client sign in as any SCRAM user, including superusers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.oracle.com/security-alerts/cpuoct2026.html" rel="noopener noreferrer"&gt;MySQL October patch update&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 20&lt;/td&gt;
&lt;td&gt;None stated&lt;/td&gt;
&lt;td&gt;Quarterly MySQL fixes; 8.4 is affected through 8.4.12&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://mariadb.com/docs/server/security/cve/community-server" rel="noopener noreferrer"&gt;MariaDB&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 9 and 16&lt;/td&gt;
&lt;td&gt;None stated&lt;/td&gt;
&lt;td&gt;15 CVEs published, three rated 9.9; fixes already shipped&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.postgresql.org/about/news/pgvector-087-released-3392/" rel="noopener noreferrer"&gt;pgvector&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 5&lt;/td&gt;
&lt;td&gt;None stated&lt;/td&gt;
&lt;td&gt;Overflow when it builds indexes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.bleepingcomputer.com/news/security/misconfigured-supabase-apps-expose-data-in-over-16-000-databases/" rel="noopener noreferrer"&gt;Supabase exposure&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Sep 28&lt;/td&gt;
&lt;td&gt;AI-built apps, probably&lt;/td&gt;
&lt;td&gt;16,000+ readable databases, most with row-level security turned off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://thehackernews.com/2026/10/opencode-console-breach-may-have.html" rel="noopener noreferrer"&gt;OpenCode Console&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 16-17&lt;/td&gt;
&lt;td&gt;AI keys targeted&lt;/td&gt;
&lt;td&gt;Stored LLM API keys may have been exposed for about 1.4 percent of users.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://thehackernews.com/2026/10/atlassian-data-center-flaw-draws.html" rel="noopener noreferrer"&gt;Atlassian Data Center&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Patched about Oct 6&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Unauthenticated file read that leads to admin access, exploited within hours of a public write-up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.securityweek.com/chinese-apt-exploited-beyondtrust-vulnerability-as-zero-day/" rel="noopener noreferrer"&gt;BeyondTrust Remote Support&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Fixed Oct 8&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;A zero-day exploited since August&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.bleepingcomputer.com/news/security/ivanti-warns-of-connect-secure-zero-day-exploited-in-attacks/" rel="noopener noreferrer"&gt;Ivanti Connect Secure&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Oct 13&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;A zero-day, with part of the attack chain still unpatched&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.abc.net.au/news/2026-09-24/ai-agent-accessed-australian-government-site-pm-says/107189078" rel="noopener noreferrer"&gt;OpenAI agent and Medicare Australia&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Disclosed Sep 24&lt;/td&gt;
&lt;td&gt;Agent ran the access&lt;/td&gt;
&lt;td&gt;A lab's test agent reached a government statistics portal.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>news</category>
    </item>
    <item>
      <title>Readyset HA with ProxySQL and MySQL</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Thu, 22 Oct 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/readyset-ha-with-proxysql-and-mysql-1gbm</link>
      <guid>https://dev.to/readyset/readyset-ha-with-proxysql-and-mysql-1gbm</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwx9px7rm1ln7juutug96.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwx9px7rm1ln7juutug96.png" alt="Readyset HA with ProxySQL and MySQL" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A query cache stores the result of a SQL query and answers later identical queries from that stored copy instead of running them again. Readyset is a query cache for MySQL and PostgreSQL that works as a proxy: it speaks the database's wire protocol, so it can decide per query whether to answer from cache or pass the query through.&lt;/p&gt;

&lt;p&gt;Speaking the wire protocol is what makes Readyset drop-in: anything that can connect to MySQL can connect to Readyset instead, with no driver or query change. Put two Readyset nodes behind ProxySQL and you have a cache tier that survives losing a node.&lt;/p&gt;

&lt;p&gt;We wanted to know how small that change really is when the topology already exists. So we built the boring version of a production setup, a MySQL source with a replica and a pair of ProxySQL nodes in cluster mode in front of both, gave it a report query that costs 106 ms, and counted the steps needed to put a highly available (HA) cache behind that one query. It came to two &lt;code&gt;docker run&lt;/code&gt;commands and two &lt;code&gt;INSERT&lt;/code&gt; statements in ProxySQL's admin interface. Nothing in the application changed, and neither did the schema or MySQL's configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a ProxySQL and MySQL topology looks like before Readyset
&lt;/h2&gt;

&lt;p&gt;Seven machines in one availability zone, all &lt;code&gt;c6i.large&lt;/code&gt;, which is 2 virtual central processing units (vCPUs) and 4 GiB of memory each. MySQL 8.0.46 on the source and on the replica, two ProxySQL 2.6.5 nodes in front of them, and the &lt;a href="https://dev.mysql.com/doc/sakila/en/" rel="noopener noreferrer"&gt;sakila sample database&lt;/a&gt; loaded on the source and replicated down.&lt;/p&gt;

&lt;p&gt;Both ProxySQL nodes are configured the way most people configure one: hostgroup 10 is the writer, hostgroup 20 is the reader, writes go to the source, and a catch-all rule sends anything matching &lt;code&gt;^SELECT&lt;/code&gt; to the replica.&lt;/p&gt;

&lt;p&gt;The two proxies run in ProxySQL's cluster mode, which makes them peers. Each lists the other in &lt;code&gt;proxysql_servers&lt;/code&gt;, they share a cluster credential, and a configuration change applied to either one is pulled by the other within a few seconds. That is why adding Readyset below costs the same two statements it would cost with a single proxy.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Hostgroup&lt;/th&gt;
&lt;th&gt;Backend&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;MySQL source&lt;/td&gt;
&lt;td&gt;all writes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;MySQL replica&lt;/td&gt;
&lt;td&gt;all reads&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Everything in grey below was already running. Everything in green is what this post adds.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frx4h5kykapdeakt4a6jf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frx4h5kykapdeakt4a6jf.png" alt="Topology: an application connects to either of two clustered ProxySQL nodes, which route writes to the MySQL source, most SELECT statements to the MySQL replica, and one query digest to a new hostgroup holding two Readyset nodes with the replica as a weight 1 fallback" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The two Readyset nodes and the hostgroup 30 routing are the whole change. Readyset connects to the replica as an ordinary SQL client, so there is no replication stream into it and nothing to configure on MySQL. The purple link is ProxySQL's cluster sync, which is why the routing has to be added on only one of the two proxies.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Which query is worth caching, and how ProxySQL tells you
&lt;/h2&gt;

&lt;p&gt;ProxySQL already knows. It keeps a digest table of every query shape it has seen, with the total time spent on each, and the answer falls out of one query against the admin interface on port 6032.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;hostgroup&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;hg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count_star&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;calls&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;ROUND&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum_time&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1000000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;total_s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;ROUND&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum_time&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;count_star&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;avg_ms&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="n"&gt;substr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;digest_text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;stats_mysql_query_digest&lt;/span&gt;
 &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;sum_time&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt; &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="n"&gt;hg&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt; &lt;span class="n"&gt;calls&lt;/span&gt; &lt;span class="n"&gt;total_s&lt;/span&gt; &lt;span class="n"&gt;avg_ms&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;
&lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;xAD23E0866F6BDE4B&lt;/span&gt; &lt;span class="mi"&gt;140&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;ci&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;c&lt;/span&gt;
&lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;xDDE78179CF5B1440&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;film&lt;/span&gt;
&lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;xAC447120122130DE&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;actor&lt;/span&gt;
&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="n"&gt;xFE0D5031018F599A&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;SET&lt;/span&gt; &lt;span class="k"&gt;NAMES&lt;/span&gt; &lt;span class="n"&gt;utf8mb4&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The ProxySQL admin interface is SQLite underneath, so &lt;code&gt;substr()&lt;/code&gt; works and&lt;code&gt;LEFT()&lt;/code&gt; does not. One shape accounts for all of the time. It is a customer leaderboard: the top 25 customers by lifetime value, each annotated with the film category they spend the most on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ci&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;lifetime_value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;payment_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;payments&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;
          &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;payment&lt;/span&gt; &lt;span class="n"&gt;p2&lt;/span&gt;
          &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;rental&lt;/span&gt; &lt;span class="n"&gt;r2&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;r2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rental_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rental_id&lt;/span&gt;
          &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt; &lt;span class="n"&gt;i2&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;i2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inventory_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inventory_id&lt;/span&gt;
          &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;film_category&lt;/span&gt; &lt;span class="n"&gt;fc&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;fc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;film_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;film_id&lt;/span&gt;
          &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;category&lt;/span&gt; &lt;span class="n"&gt;cat&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;category_id&lt;/span&gt;
         &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;p2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;
         &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;
         &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
         &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;top_category&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;customer&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;
  &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address_id&lt;/span&gt;
  &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt; &lt;span class="n"&gt;ci&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;ci&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;city_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;city_id&lt;/span&gt;
  &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;payment&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;
 &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;first_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;last_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ci&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;
 &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;lifetime_value&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
 &lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This query is not a straw man. &lt;code&gt;EXPLAIN&lt;/code&gt; shows every join resolving through an index, and sakila is about 10 MB against a 2 GB buffer pool, so the whole working set is in memory and no read touches a disk. It costs 106 ms anyway, because the correlated subquery is a &lt;code&gt;DEPENDENT SUBQUERY&lt;/code&gt; that MySQL evaluates once per customer. That is 599 executions of a five-table join, each building a temporary table and sorting it, on every single call.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why not just rewrite the slow query
&lt;/h2&gt;

&lt;p&gt;That is the first thing a database engineer asks, so we measured it. We rewrote the correlated subquery as a window function over a common table expression, which is the textbook fix, and ran both forms against the same replica.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Form&lt;/th&gt;
&lt;th&gt;p50 latency&lt;/th&gt;
&lt;th&gt;Queries per second&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Original, with correlated subquery&lt;/td&gt;
&lt;td&gt;106.360 ms&lt;/td&gt;
&lt;td&gt;9.44&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rewritten with &lt;code&gt;ROW_NUMBER()&lt;/code&gt; over a common table expression&lt;/td&gt;
&lt;td&gt;88.595 ms&lt;/td&gt;
&lt;td&gt;11.32&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Single connection, 8 s warmup and 25 s measured, read directly against the MySQL replica.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The rewrite is worth 1.2x. The work being done is the same either way: aggregate 16,044 payments across a five-table join, then do the whole thing again for the next caller. Routing the query to Readyset is worth 149x on the same hardware, and it gets there by skipping the work rather than by doing it faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  The minimal steps to add Readyset behind ProxySQL
&lt;/h2&gt;

&lt;p&gt;Three commands total, and none of them touch MySQL, the application, or the second proxy.&lt;/p&gt;

&lt;p&gt;First, run Readyset on two hosts. Each one is independent of the other, with no shared state and no clustering to configure. &lt;code&gt;AUTO_CACHE=true&lt;/code&gt; is the whole configuration: it is shorthand for &lt;code&gt;--cache-mode=shallow --query-caching=inrequestpath&lt;/code&gt;, which means every previously unseen &lt;code&gt;SELECT&lt;/code&gt;becomes a candidate for a cache that Readyset creates by itself, on the request path, the first time it sees the query.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; readyset &lt;span class="nt"&gt;--restart&lt;/span&gt; unless-stopped &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 3307:3307 &lt;span class="nt"&gt;-p&lt;/span&gt; 6034:6034 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;UPSTREAM_DB_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mysql://app:readyset@&amp;lt;replica-ip&amp;gt;:3306/sakila &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;LISTEN_ADDRESS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.0.0.0:3307 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;AUTO_CACHE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  public.ecr.aws/readyset/readyset:latest-nightly

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We pointed both nodes at the read replica rather than the source, so the queries Readyset runs upstream land on the machine that already serves reads.&lt;/p&gt;

&lt;p&gt;Docker is here because it makes the deployment one command that a reader can run verbatim, which is what a demonstration needs. It is not the only option: the same adapter ships as &lt;code&gt;.deb&lt;/code&gt; and &lt;code&gt;.rpm&lt;/code&gt; packages for x86_64 and arm64, run under systemd and configured through &lt;code&gt;/etc/readyset/readyset.conf&lt;/code&gt;. Both paths are covered at&lt;a href="https://readyset.io/docs/cache/install-rs" rel="noopener noreferrer"&gt;Install Readyset Cache&lt;/a&gt;. The flags below are the same either way, as environment variables in Docker or as settings in the configuration file.&lt;/p&gt;

&lt;p&gt;Both nodes were accepting connections about 45 seconds after &lt;code&gt;docker run&lt;/code&gt;returned, and that is the whole startup. In shallow mode Readyset does not replicate, which the log states plainly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INFO readyset_server::controller::inner: Replication disabled; skipping snapshotting and replication

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No replication user, no binary-log position, no snapshot of the dataset, no publication and no slot. Readyset connects to the upstream the same way any client does, runs the query on a miss, and keeps the result.&lt;/p&gt;

&lt;p&gt;Second, tell ProxySQL the nodes exist, and point one query shape at them. This is the only change to the existing topology, and in cluster mode it is applied to one proxy rather than to each of them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- Hostgroup 30 is the new cache tier. The replica joins it at weight 1, which&lt;/span&gt;
&lt;span class="c1"&gt;-- makes it an automatic fallback: it takes 1 read in 2001 while Readyset is&lt;/span&gt;
&lt;span class="c1"&gt;-- healthy, and all of them when both Readyset nodes are gone.&lt;/span&gt;
&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;mysql_servers&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hostgroup_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hostname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_connections&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;readyset-1-ip&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3307&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'readyset-1'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
       &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;readyset-2-ip&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3307&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'readyset-2'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
       &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;replica-ip&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3306&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'mysql-replica-fallback'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;-- Route exactly one query shape at the cache, by the digest ProxySQL reported.&lt;/span&gt;
&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;mysql_query_rules&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rule_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;destination_hostgroup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'0xAD23E0866F6BDE4B'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;LOAD&lt;/span&gt; &lt;span class="n"&gt;MYSQL&lt;/span&gt; &lt;span class="n"&gt;SERVERS&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;RUNTIME&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;LOAD&lt;/span&gt; &lt;span class="n"&gt;MYSQL&lt;/span&gt; &lt;span class="n"&gt;QUERY&lt;/span&gt; &lt;span class="n"&gt;RULES&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;RUNTIME&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;SAVE&lt;/span&gt; &lt;span class="n"&gt;MYSQL&lt;/span&gt; &lt;span class="n"&gt;SERVERS&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;DISK&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;SAVE&lt;/span&gt; &lt;span class="n"&gt;MYSQL&lt;/span&gt; &lt;span class="n"&gt;QUERY&lt;/span&gt; &lt;span class="n"&gt;RULES&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;DISK&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Routing by digest rather than by table is what keeps the change small. The same tables keep serving hostgroup 20 for every other query. Only this one shape moves.&lt;/p&gt;

&lt;p&gt;We ran that against &lt;code&gt;proxysql-1&lt;/code&gt; and nothing at all against &lt;code&gt;proxysql-2&lt;/code&gt;. The second proxy picked the change up on its own in 3.7 seconds:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;### proxysql-2 BEFORE, nothing applied to it directly
hostgroup 30 servers: 0
rule 50 present: 0

### applying the change to proxysql-1 ONLY
propagated to proxysql-2 in 3.7s, with no command run against it

### proxysql-2 AFTER
30 172.31.38.52 3306 1 mysql-replica-fallback
30 172.31.39.254 3307 1000 readyset-1
30 172.31.44.109 3307 1000 readyset-2
rule 50:
50 1 0xAD23E0866F6BDE4B 30

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is what cluster mode buys. Adding a cache tier to a pair of proxies is the same two statements as adding it to one, so the two proxies cannot drift into routing the same query differently.&lt;/p&gt;

&lt;p&gt;One credential detail is easy to miss. Readyset authenticates incoming clients against its own upstream user, so the user ProxySQL uses for its backend connections has to be the same user that appears in &lt;code&gt;UPSTREAM_DB_URL&lt;/code&gt;. A separate application user gets an access denied error at the Readyset connection.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed after routing one query to Readyset
&lt;/h2&gt;

&lt;p&gt;Same driver, same ProxySQL endpoint, same query text. The only difference between the two halves of each pair is whether rule 50 is active.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concurrency&lt;/th&gt;
&lt;th&gt;MySQL p50&lt;/th&gt;
&lt;th&gt;Readyset p50&lt;/th&gt;
&lt;th&gt;MySQL q/s&lt;/th&gt;
&lt;th&gt;Readyset q/s&lt;/th&gt;
&lt;th&gt;Latency ratio&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;106.376 ms&lt;/td&gt;
&lt;td&gt;0.716 ms&lt;/td&gt;
&lt;td&gt;9.43&lt;/td&gt;
&lt;td&gt;1291.93&lt;/td&gt;
&lt;td&gt;149x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;396.784 ms&lt;/td&gt;
&lt;td&gt;2.401 ms&lt;/td&gt;
&lt;td&gt;10.27&lt;/td&gt;
&lt;td&gt;1463.33&lt;/td&gt;
&lt;td&gt;165x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;795.061 ms&lt;/td&gt;
&lt;td&gt;5.398 ms&lt;/td&gt;
&lt;td&gt;10.33&lt;/td&gt;
&lt;td&gt;1301.70&lt;/td&gt;
&lt;td&gt;147x&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;10 s warmup, 30 s measured, zero errors in every run. Latency ratio is p50 against p50.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx44l3dnxt69p956gg8qz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx44l3dnxt69p956gg8qz.png" alt="Bar chart of median latency for the same query at one, four and eight clients: the MySQL replica takes 107, 403 and 795 ms while Readyset takes 0.765, 2.385 and 5.311 ms" width="799" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The Readyset bars are drawn at a 3 pixel minimum so they are visible at all; at this scale their true widths are half a pixel. These are 2 vCPU demo machines and one query, so read the shape rather than the absolute numbers.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The rows come back identical. We compared the full result set and every field of every column definition between the cached path and the replica read directly: 25 rows, 7 columns, byte for byte the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to confirm Readyset served the reads
&lt;/h2&gt;

&lt;p&gt;A cache that exists is not a cache that is being used, and the failure mode looks like success: correct rows at a plausible latency, quietly served by the database. So we checked three separate things.&lt;/p&gt;

&lt;p&gt;ProxySQL answers the first two: is the rule firing, and where did the query actually go. Both come from the admin interface on port 6032.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- is the routing rule matching, and how often&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rule_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hits&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;destination_hostgroup&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;stats_mysql_query_rules&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;
  &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;runtime_mysql_query_rules&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rule_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rule_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- and which hostgroup actually served that query shape&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;hostgroup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count_star&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;stats_mysql_query_digest&lt;/span&gt;
 &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'0xAD23E0866F6BDE4B'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We sent 800 reads at &lt;code&gt;proxysql-1&lt;/code&gt; and 400 at &lt;code&gt;proxysql-2&lt;/code&gt;, and each proxy counted only its own share:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--- proxysql-1 (drove 800) ---
hostgroup digest count_star
30 0xAD23E0866F6BDE4B 800

--- proxysql-2 (drove 400) ---
rule_id hits destination_hostgroup
50 400 30
100 1 20
hostgroup digest count_star
30 0xAD23E0866F6BDE4B 400

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both proxies send the digest to hostgroup 30, and rule 100, the pre-existing catch-all, still handles everything else. One caveat if you run this yourself:&lt;code&gt;stats_mysql_query_rules&lt;/code&gt; is flushed asynchronously, so straight after a burst it can lag the digest table by a few seconds before the two agree.&lt;/p&gt;

&lt;p&gt;That proves the query reached Readyset. It does not prove Readyset answered from cache rather than passing the query upstream, which is the failure that looks exactly like success. Readyset's own per-query counters settle it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight prometheus"&gt;&lt;code&gt;&lt;span class="n"&gt;curl&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="n"&gt;localhost:6034&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;metrics&lt;/span&gt; &lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="n"&gt;grep&lt;/span&gt; &lt;span class="n"&gt;readyset_shallow_shallow_result&lt;/span&gt;


&lt;span class="o"&gt;---&lt;/span&gt; &lt;span class="n"&gt;readyset&lt;/span&gt;&lt;span class="mi"&gt;-1&lt;/span&gt; &lt;span class="o"&gt;---&lt;/span&gt;
&lt;span class="n"&gt;readyset_shallow_shallow_result_hit&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;query_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"q_d618b5595f3efeab"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="mi"&gt;98347&lt;/span&gt;
&lt;span class="n"&gt;readyset_shallow_shallow_result_miss&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;query_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"q_d618b5595f3efeab"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;span class="o"&gt;---&lt;/span&gt; &lt;span class="n"&gt;readyset&lt;/span&gt;&lt;span class="mi"&gt;-2&lt;/span&gt; &lt;span class="o"&gt;---&lt;/span&gt;
&lt;span class="n"&gt;readyset_shallow_shallow_result_hit&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;query_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"q_d618b5595f3efeab"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="mi"&gt;93984&lt;/span&gt;
&lt;span class="n"&gt;readyset_shallow_shallow_result_miss&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="na"&gt;query_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"q_d618b5595f3efeab"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hits move with the traffic and misses stay in single digits. Both nodes built the same cache for the same query identifier on their own, and both carried roughly half the reads. A Readyset node whose hit counter is flat while queries flow through it is serving everything from the database, and this is the counter to alert on.&lt;/p&gt;

&lt;p&gt;Then we measured the instrument itself. A bare &lt;code&gt;SELECT 1&lt;/code&gt; over the same path, from the same driver through the same ProxySQL, costs 0.280 ms at p50. That is the client library, two network hops and the proxy, and it is 39% of Readyset's 0.716 ms. Readyset's own contribution to the cached read is closer to 0.44 ms.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens when a Readyset node or a ProxySQL node dies
&lt;/h2&gt;

&lt;p&gt;Two tiers can now lose a node, so we killed one on each.&lt;/p&gt;

&lt;p&gt;We ran the query continuously with four clients and stopped the Readyset nodes underneath it, checking every second whether the application was still getting correct answers.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Event&lt;/th&gt;
&lt;th&gt;What the client saw&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;docker stop&lt;/code&gt; on Readyset 1&lt;/td&gt;
&lt;td&gt;three errored connections in the second it happened, then cached reads again from the survivor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;docker stop&lt;/code&gt; on Readyset 2, both now gone&lt;/td&gt;
&lt;td&gt;reads served by the replica through the weight 1 fallback&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Throughout&lt;/td&gt;
&lt;td&gt;no second passed without completed queries, and the top row of the report never changed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Losing one Readyset node did not show up in the latency series at all. The survivor absorbed the traffic and the application had no way to tell.&lt;/p&gt;

&lt;p&gt;Then we did the same to a proxy, with the load running against &lt;code&gt;proxysql-2&lt;/code&gt; and&lt;code&gt;proxysql-1&lt;/code&gt; stopped underneath it.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Queries per second&lt;/th&gt;
&lt;th&gt;p50&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Load on proxysql-2, both proxies up&lt;/td&gt;
&lt;td&gt;1460&lt;/td&gt;
&lt;td&gt;2.47 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Load on proxysql-2, proxysql-1 stopped&lt;/td&gt;
&lt;td&gt;1454&lt;/td&gt;
&lt;td&gt;2.40 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Zero errors, and no second without completed queries.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The client talking to the surviving proxy did not notice, which is what a second proxy is for. Cluster mode also covers the rebuild. We brought &lt;code&gt;proxysql-1&lt;/code&gt; back from an empty configuration, with its data volume deleted and &lt;code&gt;--initial&lt;/code&gt; on the command line, and it pulled the whole Readyset routing from its peer without being told any of it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hostgroup 30 on the rebuilt proxysql-1, which was never told about Readyset:
30 172.31.38.52 3306 1 mysql-replica-fallback
30 172.31.39.254 3307 1000 readyset-1
30 172.31.44.109 3307 1000 readyset-2
50 1 0xAD23E0866F6BDE4B 30

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Losing both Readyset nodes fell through to the replica and the application kept working at the speed it had before Readyset existed. That is the useful property of the weighted fallback: the degraded mode is the system you already had, not an error page. The handful of errors across these runs were connections in flight when a container was killed, and a client with retry logic would have swallowed them.&lt;/p&gt;

&lt;p&gt;We did not measure how much load a pair of Readyset nodes can take, so none of these figures is a capacity claim. Two 2 vCPU machines is a demonstration size, not a sizing exercise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the Readyset and ProxySQL pattern applies
&lt;/h2&gt;

&lt;p&gt;The topology has to be a proxy that can route by query shape, in front of at least one read query expensive enough that the round trip to Readyset is worth avoiding. On a query that already runs in 2 ms, none of this pays for itself, because the floor we measured is 0.342 ms of driver and network before Readyset does anything at all.&lt;/p&gt;

&lt;p&gt;The two Readyset nodes are independent caches, not a cluster. There is no shared state between them and nothing to configure to pair them up, which is the opposite of the ProxySQL pair, where cluster mode is the whole point. ProxySQL spreads reads across both Readyset nodes and takes either one out of rotation on its own, and that is what makes the Readyset failover simple.&lt;/p&gt;

&lt;p&gt;What kept the change small is that nothing in the application knew about it. The connection string still points at ProxySQL, and the query text, the schema and MySQL's configuration are all exactly what they were. Cluster mode kept it small in the other direction too: a second proxy did not mean a second copy of the work. One query moved from a hostgroup that costs 106 ms to a Readyset hostgroup that costs 0.716 ms, and the rest of the workload never noticed.&lt;/p&gt;

&lt;p&gt;The documentation for shallow caching, the &lt;code&gt;--auto-cache&lt;/code&gt; flag and the other installation methods is at&lt;a href="https://readyset.io/docs/cache/install-rs" rel="noopener noreferrer"&gt;Install Readyset Cache&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>tutorials</category>
      <category>mysql</category>
      <category>querycaching</category>
      <category>databasescaling</category>
    </item>
    <item>
      <title>Meet the RDST Agent</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Wed, 14 Oct 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/meet-the-rdst-agent-26fb</link>
      <guid>https://dev.to/readyset/meet-the-rdst-agent-26fb</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnbw3j7hng82a0f6kmj3r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnbw3j7hng82a0f6kmj3r.png" alt="Meet the RDST Agent" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An always-on agent that catches every slow query on your PostgreSQL or MySQL database and gives you the exact fix. It runs on your computer.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Product Updates | Readyset team | October 14, 2026&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When a query gets slow, a customer usually notices first. The RDST Agent is built to catch it before that. It's a free, always-on agent that runs on your computer, watches every query on your Postgres or MySQL database, and hands you the exact fix.&lt;/p&gt;

&lt;p&gt;Teams with a DBA or a monitoring budget usually have tooling that watches for this. A lot of teams running Postgres or MySQL on RDS, Supabase, Neon or their own servers don't, so query performance tends to get checked after something breaks.&lt;/p&gt;

&lt;p&gt;Today we're releasing the &lt;strong&gt;RDST Agent&lt;/strong&gt; , a free, always-on agent that runs on your computer, catches every slow query on your database, and gives you the exact fix when something goes wrong.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5wpc13pkwtxekmfz2rql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5wpc13pkwtxekmfz2rql.png" alt="RDST Agent home screen showing two monitored databases, one item that needs attention, and the day's agent activity" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Home: two databases, one thing that needs you, and everything the agent did today.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To show what that looks like, we'll follow one afternoon on &lt;code&gt;shop-prod&lt;/code&gt;, the PostgreSQL database behind an online store.&lt;/p&gt;

&lt;h2&gt;
  
  
  It keeps a history of every query
&lt;/h2&gt;

&lt;p&gt;When you turn on monitoring, RDST reads your database's query statistics every minute, from &lt;code&gt;pg_stat_statements&lt;/code&gt; on PostgreSQL or &lt;code&gt;performance_schema&lt;/code&gt; on MySQL. It builds a history for every query: how often it runs, how long it takes and how much of the database's time it uses. The last 48 hours stay minute by minute, and older readings roll up into hourly and daily summaries that reach back months.&lt;/p&gt;

&lt;p&gt;On &lt;code&gt;shop-prod&lt;/code&gt;, the query behind the store's order history page usually takes about 6 ms. At 2:05 PM a deploy adds a new "My orders" page, and that same query starts taking 184 ms. Within minutes it's using almost a third of the database's time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fijle4rw2lkoffgx79173.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fijle4rw2lkoffgx79173.png" alt="Chart of shop-prod at 2:14 PM showing the order history query spiking from 6 ms to 184 ms after the deploy, with a desktop notification" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;shop-prod at 2:14 PM. Order history jumps after the deploy, and the agent sends a desktop notification.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  It notices, and it knows what's worth your time
&lt;/h2&gt;

&lt;p&gt;Every 5 minutes the agent compares each busy query against its own history. It looks for queries that got slower or busier, changed plans, got stuck or started waiting on locks.&lt;/p&gt;

&lt;p&gt;Most of those changes don't deserve an interruption. Jev, Readyset's attention model, decides which ones do. Order history getting 30x slower clears the bar, so at 2:14 PM it lands in the Inbox under &lt;strong&gt;Act now&lt;/strong&gt; and a notification shows up on the desktop. Smaller wobbles stay on the chart for when you go looking.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqpo1zg1daymrpf5oq0f2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqpo1zg1daymrpf5oq0f2.png" alt="Inbox item explaining what changed in the order history query and what to check, with the SQL for each step" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The Inbox item explains what changed and what to check, with the SQL for each step.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  It does the analysis nobody has time for
&lt;/h2&gt;

&lt;p&gt;Two minutes later, the agent has a deep analysis. It runs &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; on the query with a real &lt;code&gt;customer_id&lt;/code&gt; sampled from live traffic, and the plan shows the problem right away. Postgres is reading all 2.4 million rows of &lt;code&gt;orders&lt;/code&gt; to find one customer's 20 most recent orders. The fix is a composite index on &lt;code&gt;customer_id&lt;/code&gt; and &lt;code&gt;created_at&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;New heavy queries get this treatment as they show up, and every night the agent writes a report for each database with what to fix first, along with checks for bloat, unused indexes, settings and replication.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2nnoeavthhpdg61lfgs4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2nnoeavthhpdg61lfgs4.png" alt="Deep analysis scoring the query, showing what the execution plan is doing, and naming the composite index to add on customer_id and created_at" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The analysis scores the query, shows what the plan is doing, and names the index to add.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Actions: one list of changes worth making
&lt;/h2&gt;

&lt;p&gt;Everything the agent learns feeds &lt;strong&gt;Actions&lt;/strong&gt; , a ranked list of the changes worth making across your databases. The new index goes straight to the top of &lt;strong&gt;Do first&lt;/strong&gt; , because it saves about 7 seconds of database time every minute.&lt;/p&gt;

&lt;p&gt;Right below it is an index to drop. &lt;code&gt;orders_status_idx&lt;/code&gt; hasn't been used in 30 days, and every one of the 220 writes a second to &lt;code&gt;orders&lt;/code&gt; still has to maintain it. The agent weighs each index against how often its table gets written to, so it'll recommend removing dead weight as readily as adding what's missing. Each action comes with the SQL to run and the SQL to undo it, and you can copy it as a migration for Alembic, Prisma, Rails or Flyway.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fifezi43ezlwc5khqtig6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fifezi43ezlwc5khqtig6.png" alt="Actions list for both databases, ranked into Do first, Then, and Later, each with the SQL to run and to undo" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Actions for both databases, ranked into Do first, Then and Later.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;RDST never writes to your database.&lt;/strong&gt; You ship the change the way you ship any other migration, and the agent checks whether it worked.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At 3:02 PM the new index shows up on &lt;code&gt;shop-prod&lt;/code&gt;. The agent measures Order history before and after: 184 ms down to 3.8 ms, and from 31% of the database's time to 2%. The action closes as Verified.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn8spjoz6vkv39dn1i5ag.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn8spjoz6vkv39dn1i5ag.png" alt="Verified action showing the order history query measured before and after the index: 184 ms down to 3.8 ms, 31% of database time down to 2%" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Verified: the agent measured the query before and after the index went in.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it runs on your desktop
&lt;/h2&gt;

&lt;p&gt;We could have started with a hosted service. We started on the desktop because it's the shortest path to the databases people actually care about.&lt;/p&gt;

&lt;p&gt;Your database credentials stay in your operating system's keychain. The connection runs from your machine straight to your database, so there's nothing to install on your servers, and Readyset never needs network access to your database. It reaches whatever your machine can reach, including a local Docker container, a database behind your VPN, or a private instance through an SSH jump host. Query history lives in a local SQLite database on your computer.&lt;/p&gt;

&lt;p&gt;There's a tradeoff. The agent only collects while your computer is awake, and right now it's built for one person. For teams that want an agent running around the clock on their own infrastructure, we're working out a cloud version for enterprise teams. If that's you, tell us what you'd need at &lt;a href="mailto:hello@readyset.io"&gt;hello@readyset.io&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What gets sent to AI
&lt;/h2&gt;

&lt;p&gt;Collecting stats, keeping history, running health checks and doing the arithmetic in reports all happen on your machine with no model involved. Two things go out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deep analyses and reports&lt;/strong&gt; run on Claude Haiku from Anthropic. We don't send anything to foreign models. A request carries the query, its execution plan and the schema of the tables it touches, stripped of your data: no table contents, no result rows and no credentials. Anthropic doesn't train on API data. If you'd rather use your own Anthropic key, analysis goes straight from your machine to Anthropic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Jev&lt;/strong&gt; sees normalized query text along with table and index statistics, which is what it needs to decide what's worth your attention.&lt;/p&gt;

&lt;p&gt;Every AI call the agent makes is listed on the Agent activity page, with what it did and when. The privacy docs cover the rest.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4hvrq8zjs21nmmexz19w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4hvrq8zjs21nmmexz19w.png" alt="Agent activity page listing every check, analysis, and verification the agent ran that Tuesday" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Agent activity: every check, analysis and verification from that Tuesday.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;RDST is free and open source under Apache 2.0. It supports PostgreSQL 13+ and MySQL 8.0+ and runs on macOS (Apple Silicon), Windows and Linux. There's a demo database built in if you want to watch the agent work before you point it at your own.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://readyset.io/downloads" rel="noopener noreferrer"&gt;Download RDST&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Read the docs | &lt;a href="https://github.com/readysettech/rdst" rel="noopener noreferrer"&gt;RDST on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We'd love to hear what it finds on your database, and what it gets wrong. Come tell us in the &lt;a href="https://go.readyset.io/community" rel="noopener noreferrer"&gt;Readyset Slack&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>productupdates</category>
      <category>querycaching</category>
    </item>
    <item>
      <title>What Is a Wire-Compatible SQL Caching Proxy?</title>
      <dc:creator>ReadySet</dc:creator>
      <pubDate>Thu, 08 Oct 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/readyset/what-is-a-wire-compatible-sql-caching-proxy-24oi</link>
      <guid>https://dev.to/readyset/what-is-a-wire-compatible-sql-caching-proxy-24oi</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnvqo6ufhdcbtm37fotol.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnvqo6ufhdcbtm37fotol.png" alt="What Is a Wire-Compatible SQL Caching Proxy?" width="800" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A wire-compatible SQL caching proxy sits between your application and your database, speaking the same protocol the database speaks. Because of this, your app can connect to the proxy instead of the database without any code changes, just swap the hostname or port.&lt;/p&gt;

&lt;p&gt;The idea is simple. Right now, every query goes straight to the database:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffmwhxrauwz0qjh5vb7n2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffmwhxrauwz0qjh5vb7n2.png" alt="Diagram: application connecting directly to the database" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With a caching proxy in front, the first time a query runs, it goes to the database as usual and the result gets cached:&lt;/p&gt;

&lt;p&gt;The next time that same query runs, the proxy can skip the database entirely and answer from cache.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F96ekoq9atsa2b3nzq36r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F96ekoq9atsa2b3nzq36r.png" alt="Diagram: application querying through a caching proxy, served from cache on repeat" width="799" height="417"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This cuts down on database load: fewer round trips, less query execution, and lower CPU and I/O usage, especially for read-heavy workloads where the same queries run over and over.&lt;/p&gt;

&lt;p&gt;The tricky part is that caching SQL isn't as simple as storing a query string and its result. The proxy has to figure out when two queries are really asking for the same thing, know when cached data has gone stale and needs to be refreshed, and handle things like transactions, prepared statements, and session state correctly, all while staying invisible to the application.&lt;/p&gt;

&lt;p&gt;In short: the goal is to make the database faster without the application ever knowing a cache is there.&lt;/p&gt;

&lt;h2&gt;
  
  
  How is this different from Redis or application-level caching?
&lt;/h2&gt;

&lt;p&gt;The short version: Redis and application-level caching put the caching decisions in your code. A wire-compatible SQL caching proxy puts them in a separate layer, so your application doesn't have to think about caching at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Redis-style caching works.&lt;/strong&gt; Your application talks to two systems and has to coordinate between them:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkawanzrbdbyqgjajeerw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkawanzrbdbyqgjajeerw.png" alt="Diagram: application talking to both Redis and the database" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your code has to spell out the caching logic itself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user:123&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM users WHERE id = 123&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user:123&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That means your application now owns a lot of extra work: deciding on cache keys, converting objects to and from a storable format, setting expiration times, invalidating stale entries, handling cache misses, avoiding the "stampede" problem where many requests miss the cache at once and all hit the database together, and deciding upfront which queries are even worth caching. Redis is a general-purpose store, it doesn't know anything about SQL or your database schema. You decide what goes in it, which gives you a lot of control, but all of that logic lives in your application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How a wire-compatible SQL proxy works.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9km8rah2sbvlk7f7z52v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9km8rah2sbvlk7f7z52v.png" alt="Diagram: application connecting to the database through a SQL caching proxy in line" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your application just sends its normal SQL, exactly as before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5r2a3e4zy8ytyrq2i81o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5r2a3e4zy8ytyrq2i81o.png" alt="Diagram: the same SELECT query passing untouched through the proxy at every hop, application to proxy to database" width="800" height="284"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The proxy recognizes the query, checks whether it already has a valid and fresh cached answer, and returns it if so, otherwise it goes to the database like normal and caches the result on the way back. Your application never sees a difference and never has to check whether a result came from cache or not.&lt;/p&gt;

&lt;p&gt;The core difference, in one line: Redis caches whatever your application explicitly tells it to; a SQL caching proxy caches query results automatically, with no caching API involved, the database connection itself just gets faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;They're not competitors.&lt;/strong&gt; A SQL caching proxy doesn't replace Redis, they solve different problems and often work side by side. Redis is still the right fit for sessions, queues, rate limiting, and general application data. A SQL caching proxy takes over one specific job: making repeated database queries faster, without your code managing any of it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fudls0g7r7beivakqzdfk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fudls0g7r7beivakqzdfk.png" alt="Diagram: Redis and a SQL caching proxy serving different jobs side by side" width="799" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How is this different from a plain database caching proxy?
&lt;/h2&gt;

&lt;p&gt;They're closely related, a wire-compatible SQL caching proxy is really just a stricter, more transparent version of a database caching proxy. The difference comes down to one thing: how convincingly it impersonates the real database.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Regular caching proxy&lt;/th&gt;
&lt;th&gt;Wire-compatible SQL caching proxy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Protocol&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Its own separate API&lt;/td&gt;
&lt;td&gt;The database's native wire protocol&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Driver / client library&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Often a different one&lt;/td&gt;
&lt;td&gt;Same driver, unchanged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Connection string&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Points at the caching API&lt;/td&gt;
&lt;td&gt;Same connection string as before&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Code changes required&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Special calls (&lt;code&gt;cache.get(...)&lt;/code&gt;), rewritten queries&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Architecture&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Application → Caching API → Database&lt;/td&gt;
&lt;td&gt;Application → Proxy → Database&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;App's awareness of the cache&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Knows it's there, cache logic lives in the codebase&lt;/td&gt;
&lt;td&gt;None, has no idea it's not talking to the real database&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What actually happens behind the scenes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Reads the query, checks for a cached result, returns it if valid and fresh, otherwise queries the database and caches the result&lt;/td&gt;
&lt;td&gt;Same steps, but invisibly, the app just sees a normal query and a normal result&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5snii70mau1kzqf8dzjt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5snii70mau1kzqf8dzjt.png" alt="Diagram: side-by-side comparison of a regular caching proxy and a wire-compatible SQL caching proxy" width="798" height="199"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A closer look with MySQL
&lt;/h2&gt;

&lt;p&gt;MySQL is one of the databases this kind of proxy typically supports, alongside PostgreSQL. The idea works exactly the same way, the proxy just needs to speak MySQL's specific wire protocol.&lt;/p&gt;

&lt;p&gt;When a MySQL client connects, the server speaks first: it sends a handshake packet with a protocol version, server version string, and an authentication challenge (a random "salt"). The client responds with its username, a hashed password computed using that salt, its character set, and various capability flags. A wire-compatible proxy has to generate and validate this exact exchange, including MySQL's specific authentication plugins (&lt;code&gt;mysql_native_password&lt;/code&gt;, &lt;code&gt;caching_sha2_password&lt;/code&gt;, and others), so that any standard driver, mysql2 for Node, PyMySQL or mysqlclient for Python, Connector/J for Java, completes its handshake without ever suspecting it isn't talking to real MySQL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F80kuw3xy0at5z5qoo2me.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F80kuw3xy0at5z5qoo2me.png" alt="Diagram: MySQL handshake and query exchange between application and a wire-compatible proxy" width="800" height="960"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MySQL clients also don't only send raw query text, the protocol defines command types like &lt;code&gt;COM_QUERY&lt;/code&gt; for plain queries and &lt;code&gt;COM_STMT_PREPARE&lt;/code&gt;/&lt;code&gt;COM_STMT_EXECUTE&lt;/code&gt; for prepared statements, which most ORMs and drivers use by default. A proxy that only understood &lt;code&gt;COM_QUERY&lt;/code&gt; would break the moment an application used prepared statements, so it needs to track prepared statement handles per connection and cache based on the query template plus its bound parameters, not just the raw bytes sent over the wire.&lt;/p&gt;

&lt;p&gt;Results come back as a sequence of packets too, column definitions, then row data, then a closing packet, and the proxy has to reconstruct all of this exactly as MySQL would, matching data types and encodings so the driver doesn't choke on it. On top of that, MySQL connections carry session state (the current database, session variables, isolation level, autocommit mode) and support transactions, so the proxy has to track that state and be careful not to serve cached data where it would break consistency, such as inside an open transaction.&lt;/p&gt;

&lt;p&gt;Because all of this is MySQL-specific plumbing, a proxy has to implement it separately from whatever it does for PostgreSQL, which has its own different wire protocol and message framing entirely. Products like ProxySQL, Vitess, and Readyset are examples of tools that do this kind of work for MySQL (some, including Readyset, support both MySQL and PostgreSQL by implementing both protocols side by side). Being "wire-compatible with MySQL" is a specific, real engineering claim: the proxy correctly implements MySQL's handshake, its authentication plugins, its command protocol, its result encoding, and enough of its session and transaction semantics that a MySQL driver, and the application built on top of it, genuinely cannot tell it isn't talking to MySQL itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changes in your application code?
&lt;/h2&gt;

&lt;p&gt;This is where a wire-compatible proxy becomes particularly interesting. With Redis-style caching, adding a cache usually means rewriting the code that touches your data. Your simple query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM products WHERE category = &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;laptops&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;turns into something with two paths to think about:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;products:laptops&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM products WHERE category = &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;laptops&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;products:laptops&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now every developer touching this code has to understand both the cache-hit path and the cache-miss path.&lt;/p&gt;

&lt;p&gt;With a wire-compatible proxy, your code doesn't change at all:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM products WHERE category = &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;laptops&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The proxy silently takes on the hit-or-miss decision, unnoticed by anything above it, answering directly on a cache hit and asking the database then caching the result on a miss.&lt;/p&gt;

&lt;p&gt;Usually, the only real change is where your application points its connection. For a Postgres app, instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres://app:password@database:5432/shop

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it connects to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;postgres://app:password@proxy:5432/shop

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same is true for MySQL. Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mysql://app:password@database:3306/shop

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the application connects to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mysql://app:password@proxy:3306/shop

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. If your app uses mysql2 in Node, PyMySQL in Python, or Connector/J in Java, none of that code changes, you're not swapping libraries or adding a cache client, just pointing the same driver at a different host and port. Your ORM keeps generating the same queries it always did, completely unaware that a proxy is now answering some of them itself.&lt;/p&gt;

&lt;p&gt;Same driver, same SQL, same ORM, same data access code; nothing in the application layer needs to change.&lt;/p&gt;

&lt;p&gt;That said, "no code changes" doesn't mean "no setup at all." Rolling this out in production still usually involves some work: pointing things at the right connection endpoint, adjusting infrastructure, deciding which queries should be cached and for how long, thinking through how the cache stays consistent with the database, and setting up monitoring around it.&lt;/p&gt;

&lt;p&gt;So the more accurate claim is: wire compatibility doesn't eliminate configuration, it eliminates the need to rewrite application code, because the proxy looks exactly like the database to everything talking to it. That's what "drop-in" should actually mean.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Readyset works as a wire-compatible proxy
&lt;/h2&gt;

&lt;p&gt;Readyset is a real-world example of everything above. It sits directly in the path between your application and your database, rather than off to the side the way Redis does.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8mjf3c81phqfb3f54un0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8mjf3c81phqfb3f54un0.png" alt="The application keeps sending normal SQL and getting normal results back, while Readyset separately watches the database's replication stream for data changes." width="800" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your app keeps sending normal SQL queries and getting normal query results back, it has no idea Readyset is even there. Meanwhile, Readyset watches the database's replication stream (its binlog, in MySQL's case) to learn about every write as it happens, so it always knows when its cached answers need updating.&lt;/p&gt;

&lt;p&gt;Reads and writes travel different paths. Writes always go straight to the real database, they have to land in the source of truth. Reads are where Readyset earns its keep: if the answer's already cached, it hands it back instantly, no round trip, no query execution, nothing asked of the database at all.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr4rdzemsdd14if96nvz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr4rdzemsdd14if96nvz2.png" alt="Two common ways to wire it up: the application talking to Readyset directly, or a query router deciding where each query goes. A normal read replica can still exist alongside either setup." width="800" height="810"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This shows two common ways to set it up. On the left, your application talks to Readyset directly for anything that might be cached, and talks to the database directly for writes or queries Readyset hasn't cached. On the right, a query router sits in front of both and decides where each query should go, so the application doesn't even need to know Readyset exists as a separate destination. Either way, a normal read replica can still exist alongside Readyset, they're solving different problems: a read replica spreads out database load, while Readyset skips hitting the database at all for the queries it already knows the answer to.&lt;/p&gt;

&lt;p&gt;This is a step up from a typical read-replica setup. Many teams already scale reads with something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0y7uyanm2efcn0m96qwb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0y7uyanm2efcn0m96qwb.png" alt="A common existing pattern: HAProxy routes writes to a MySQL primary and reads to a read-only replica, kept in sync through logical replication." width="767" height="615"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this setup, HAProxy operates at Layer 4, it just forwards TCP connections to whichever backend a pre-configured port or pool points to, without ever reading what's inside them. It can split traffic toward a writable primary and a read-only replica, but only because the application (or its connection config) already decided which port to use; HAProxy itself has no idea whether a given connection is carrying a SELECT or an INSERT. And either way, every read that reaches the replica still has to run as a full query against a real database. Readyset replaces that pattern with something smarter: because it actually reads and understands the SQL passing through it, it can answer many reads without touching a database at all, not just route them to one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What actually happens inside Readyset.&lt;/strong&gt; This is the part that makes it more than a simple cache:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4128k3kuju0axm4hgfle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4128k3kuju0axm4hgfle.png" alt="Readyset builds a small internal pipeline for each cached query: base table nodes feed SQL operator nodes that mirror the query's joins, filters, and aggregations, landing in a reader node that holds the ready-to-serve result." width="800" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Readyset builds a small internal pipeline for each query it's asked to cache. Changes to the underlying tables (the "base table nodes") flow in from the database, pass through a chain of "SQL operator nodes" that mirror the actual joins, filters, and aggregations your query performs, and land in a "reader node" that holds the ready-to-serve result. When a row in the database changes, only the affected part of this pipeline needs to redo its work, not the whole query from scratch. This pattern is known as incremental view maintenance, and it's why Readyset is better described as a live, self-updating computation rather than a store you fill and empty by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: caching, moved to the database wire
&lt;/h2&gt;

&lt;p&gt;The idea behind a wire-compatible SQL caching proxy comes down to one simple move: instead of every application building its own caching logic, you put a proxy between the app and the database that speaks the same protocol, understands the SQL flowing through it, and transparently answers what it can from cache.&lt;/p&gt;

&lt;p&gt;That one change gets you a few things at once. Your existing queries, drivers, and ORM code mostly stay untouched. Your app never has to check a cache or invalidate one; it just sends SQL like normal. Because the proxy actually understands queries and the data behind them, it can keep answers correct as things change, not just guess with a timer. And your database itself sees less repeated work, since the proxy is absorbing traffic it would otherwise have to redo.&lt;/p&gt;

&lt;p&gt;This is genuinely different from something like Redis. Redis gives you full control over what you cache, but you have to build and maintain that logic yourself. A wire-compatible proxy takes on that job itself, sitting closer to the database, so caching becomes something that just happens rather than something your team maintains.&lt;/p&gt;

&lt;p&gt;A plain TCP load balancer like HAProxy can't do this split on its own; it just forwards connections without ever reading what's inside them, so it has no way to tell a cached-eligible read apart from a write. The split only works because the proxy sitting in this position actually speaks SQL and reads every query:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzn2z26xqrrhqkgsoazc0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzn2z26xqrrhqkgsoazc0.png" alt="Diagram: a wire-compatible SQL caching proxy answering cached reads directly and passing writes and uncached reads through to MySQL" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The bigger point is simple: don't make every team solve database caching on their own. Put that intelligence in the connection layer once, in a proxy that actually understands SQL, not just one that forwards bytes, and let it quietly make things faster for every application behind it. As more systems lean on read-heavy, increasingly complex queries, that's a real advantage, not just quicker responses, but a way to speed things up without asking developers to rethink how their code talks to the database in the first place.&lt;/p&gt;

&lt;p&gt;Caching doesn't have to live in your application anymore. It can live in the connection itself.&lt;/p&gt;

&lt;p&gt;See deep caching and the command reference for how a cached result stays correct as your data changes. Run &lt;code&gt;rdst analyze&lt;/code&gt; to find out which of your own queries are candidates before you write a line of code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://readyset.io/downloads" rel="noopener noreferrer"&gt;Install RDST&lt;/a&gt;&lt;/p&gt;

</description>
      <category>databasecaching</category>
    </item>
  </channel>
</rss>
