Getting Started
Make sure to first set up your PlanetScale developer environment. Once you’ve installed thepscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.
The insights command
Surface PlanetScale’s server-side analysis of a database: aggregated query statistics, failing query patterns, resource anomalies, and schema recommendations, all computed from production traffic.
For live, connection-level diagnostics (table sizes, locks, running queries), use pscale inspect instead.
Query insights require Query Insights to be enabled for the database. See Postgres or Vitess. Postgres and Vitess branches are supported.
Usage:
--org is required.
Available sub-commands
Available flags
Examples
The queries sub-command
List the top queries for a branch, ranked by cumulative execution time (default).
Usage:
Examples:
The queries samples sub-command
List recent executions for a specific query fingerprint. Use the fingerprint from pscale insights queries. --keyspace is required.
Usage:
Example:
The errors sub-command
List failing query patterns with error messages.
Usage:
Example:
The anomalies sub-command
List detected resource anomalies for a branch.
Usage:
The tags sub-command
List query tag keys from sqlcommenter / system tags on a branch.
Usage:
Example:
tags show
Show a query tag key and its values.
tags summaries
List query statistics grouped by one or more tag keys. --tags is required and repeatable.
The recommendations sub-command
List schema recommendations for a database: unused tables and indexes, duplicate indexes, bloated tables and indexes, missing indexes derived from production query patterns, and sequence overflow risks. Each recommendation includes ready-to-apply DDL in JSON output.
This sub-command takes a database name only (not a branch).
Usage:
recommendations dismiss
Dismiss a schema recommendation. Use the recommendation number from pscale insights recommendations. Interactive confirmation is required unless --force is passed.

