Skip to main content
The web console is currently in beta for Postgres databases.

Get started

The PlanetScale web console can be used to query any database branch; however, it is disabled for production branches by default to protect production data. To access the web console, navigate to a database, and click on the “Console” tab in the page navigation. From here, you can select which branch you’d like to connect to by selecting it in the dropdown and clicking “Connect”. Once you have accessed the web console, you can run queries against your database branch or apply DDL. The following are examples of PostgreSQL statements and meta commands you may find useful within the web console: Use \dt to see a list of tables in your database branch. Use \d table_name to obtain information about a given table’s structure. Use EXPLAIN or EXPLAIN ANALYZE in front of SELECT, INSERT, UPDATE, and DELETE statements to learn how the database is executing a query. This can be useful for optimizing slow queries.

Primary and replica connections

After connecting to a branch, use the Server dropdown in the console header to choose which node to connect to:
  • Primary — Connect to the primary node for read and write queries.
  • Replica — Connect to a read replica for read-only queries.
If a branch has no replicas, the console connects to the primary and the Replica option is unavailable. Switching between primary and replica reconnects the console and clears the current output.

Connection roles

The console creates a short-lived Postgres role for each connection. The inherited permissions depend on the selected server and your organization or database role.

Development branches

All organization roles (member, analyst, administrator) have full read and write access to development branch consoles on the primary. On a replica, the console always uses a read-only role.

Production branches

Production branch console access also requires the web console setting to be enabled. Once enabled, access depends on your role:
RoleConsole accessPrimary permissions
Organization or database AdministratorRead and writepg_read_all_data, pg_write_all_data, postgres
Organization or database AnalystRead-onlypg_read_all_data only
MemberNo access
On a replica, the console always uses a read-only role with pg_read_all_data, regardless of your primary permissions. For more information about these permissions, see Role management.

Supported console commands

CommandDescription
?, \?Synonym for help
clear, \cClear the current input statement
help, \hDisplay list of commands
;Send SQL statement to server
\d [name]List relations or describe a table
\dt [pattern]List tables
\dv [pattern]List views
\di [pattern]List indexes
\ds [pattern]List sequences
\da [pattern]List aggregate functions
\db [pattern]List tablespaces
\dc [pattern]List casts
\dconfig [pattern]List configuration parameters
\dD [pattern]List domains
\det [pattern]List foreign tables
\dn [pattern]List schemas
\do [pattern]List operators
\dO [pattern]List collations
\dp, \z [pattern]List access privileges
\dT [pattern]List data types
\du [pattern]List roles
\l [pattern]List databases
\df [pattern]List functions
\dx [pattern]List extensions

Enable for production branches

By default, the web console is disabled for production branches to protect production data. Database admins can enable the web console for production branches on the “Settings” page for the given database, app.planetscale.com/<org>/<database>/settings. Select the checkbox for “Allow web console access to production branches”, then scroll down and click the “Save database settings” button to save your changes. This will enable the ability to use the web console to run queries against production branches for the given database.

Need help?

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