Skip to main content

Getting Started

Make sure to first set up your PlanetScale developer environment. Once you’ve installed the pscale 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:
Place positional arguments first, then flags. --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:
Available flags: Examples:

The errors sub-command

List failing query patterns with error messages. Usage:
Available flags: Example:

The anomalies sub-command

List detected resource anomalies for a branch. Usage:

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:
Example:
If the database or branch is not found, or Query Insights is not enabled, the command returns an error explaining both possible causes.

pscale inspect

Query Insights (Postgres)

Query Insights (Vitess)

Schema recommendations (Postgres)

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.