close
Configuration & SQL Support
Command Reference

Readyset Command Reference

This section provides a reference for all built-in commands from Readyset.

ALTER READYSET

RESNAPSHOT TABLE

Resnapshot one specific table.

Command : ALTER READYSET RESNAPSHOT TABLE [db.table]

ADD TABLES

Add new tables to Readyset that have either been excluded from --replication-tables-ignore or omitted from --replication-tables. The command accepts a single table or a list of table comma-delimited.

The same change should be adjuster in the .cnf in order to make it persistent across restarts.

Command : ALTER READYSET ADD TABLES [db.table, db.table2]

ENTER MAINTENANCE MODE

Enter maintenance mode is meant to inform external tools like ProxySQL that Readyset is in maintenance mode and it should stop sending queries to Readyset.

Command : ALTER READYSET ENTER MAINTENANCE MODE

EXIT MAINTENANCE MODE

Exit maintenance mode is meant to inform external tools like ProxySQL that Readyset is no longer in maintenance mode and it should resume sending queries to Readyset.

Command : ALTER READYSET EXIT MAINTENANCE MODE

STOP REPLICATION

Stop the replication stream from the upstream database. While stopped, Readyset continues to serve cached data but does not receive new changes. Use this as the first step in a failover procedure.

Returns an error if replication is already stopped.

Command : ALTER READYSET STOP REPLICATION

START REPLICATION

Resume the replication stream after it has been stopped with STOP REPLICATION. Readyset reconnects to the upstream database (or the new upstream set via CHANGE CDC) and begins replicating from the stored replication position.

Returns an error if replication is already running.

Command : ALTER READYSET START REPLICATION

SET REPLICATION POSITION

Set the replication position for all tables. Replication must be stopped before running this command. The position format depends on the database:

  • MySQL binlog file and position: 'binlog.000003:154'
  • MySQL GTID: 'uuid:1-10' or a comma-separated GTID set
  • PostgreSQL LSN: '0/16B3748'

Switching between MySQL position types (binlog file/position and GTID) is allowed. Switching between MySQL and PostgreSQL is not.

For PostgreSQL failover, this command is not needed. See Failover for details.

Command : ALTER READYSET SET REPLICATION POSITION '<position>'

CHANGE CDC

Change the CDC (Change Data Capture) connection URL that Readyset uses for replication. Replication must be stopped before running this command. Use this during failover to point Readyset at a new upstream source.

The <url> must be a valid database connection URL whose protocol matches the current dialect (e.g. mysql://<user>:<password>@host/db or postgresql://<user>:<password>@host/db).

Command : ALTER READYSET CHANGE CDC TO '<url>'

CHANGE UPSTREAM

Dynamically switch the upstream database that Readyset connects to, without restarting. All client connections are closed when the upstream changes; clients must reconnect, after which they will be routed to the new upstream.

The <url> must be a valid database connection URL whose protocol matches the configured dialect (e.g. mysql://<user>:<password>@host/db or postgresql://<user>:<password>@host/db).

This command is only available when replication is disabled, i.e. in shallow caching only mode.

Command : ALTER READYSET CHANGE UPSTREAM TO '<url>'

CREATE

CACHE

Create a new cache entry for a specific SELECT Statement or QueryID.

Command : CREATE CACHE FROM [select_statement | QueryID]

SHALLOW CACHE

Create a TTL-based shallow cache for a SELECT Statement. Unlike CREATE CACHE, shallow caches do not build a materialized view; results are stored in memory and served until the TTL expires.

Command :

CREATE SHALLOW CACHE
  [POLICY TTL <n> SECONDS [REFRESH [EVERY] <n> SECONDS]]
  [COALESCE <n> SECONDS]
  [ALWAYS]
  [<name>] FROM <SELECT_STATEMENT>

For full option details, see Shallow Cache Reference.

DROP

CACHE

Drop a cache entry based on a CacheID from SHOW CACHES.

Command : DROP CACHE {CacheID}

ALL CACHES

Drop all cache entries.

Command : DROP ALL CACHES

ALL PROXIED QUERIES

Clear the list of proxied queries show at SHOW PROXIED QUERIES.

Command : DROP ALL PROXIED QUERIES

EXPLAIN

CACHES

List all CREATE CACHE statements that have been executed, for the purpose of exporting them.

Command : EXPLAIN CACHES

CREATE CACHE

Display information about how Readyset will interpret a specific query. Including if the query is supported or not.

Command : EXPLAIN CREATE CACHE FROM select_statement

DOMAINS

List domain shard replicas and what worker they're running on.

Command : EXPLAIN DOMAINS

GRAPHVIZ

Print a graphviz representation of the current query graph to stdout.

Command : EXPLAIN [SIMPLIFIED] GRAPHVIZ [FOR CACHE CacheID]

MATERIALIZATIONS

List and give information about all materializations in the graph.

Command : EXPLAIN MATERIALIZATIONS

LAST STATEMENT

Provides metadata about the last statement that was executed.

Command : EXPLAIN LAST STATEMENT

SHOW

PROXIED QUERIES

Display a list of proxied queries to upstream alongside with a status indicating if Readyset can cache the query. Optionally, users can filter only SUPPORTED queries.

Command : SHOW PROXIED [SUPPORTED] QUERIES

CACHES

Display a list of cached queries.

Command : SHOW CACHES

READYSET STATUS

Display current Readyset server status

Command : SHOW READYSET STATUS

READYSET STATUS ADAPTER

Display current Readyset adapter status.

Command : SHOW READYSET STATUS ADAPTER

READYSET MIGRATION STATUS

Display the migration status for a specific ID.

Command : SHOW READYSET MIGRATION STATUS {ID}

READYSET VERSION

Display information about the current Readyset version.

Command : SHOW READYSET VERSION

READYSET TABLES

Display the list of replicated tables and their statuses. Optionally, users can include the ALL keyword to include the non-replicated tables from the upstream.

Command : SHOW READYSET [ALL] TABLES

CONNECTIONS

Display a list of client connections.

Command : SHOW CONNECTIONS