Skip to content
Skip to content
PGB Learn

The SQL editor

Run queries and scripts against your database from the Console, use templates and history, and understand the safety limits.

Updated Nov 12, 2026

Databases > SQL Editor (the page is titled SQL Query Console) lets you run SQL against the active database without installing anything. Use the database picker at the top if the project has more than one.

Run a query

  1. Open SQL Editor and check the database name in the picker.
  2. Type SQL in the editor, or choose a table from Query Table... or a starter from Query Templates....
  3. Choose Run, or press Ctrl or Cmd plus Enter.
  4. Read the result table. The header shows the number of rows and the time taken.

Templates include EXPLAIN Query Plan, Table Sizes & Storage, Active Connections & Queries, Index Hit Rates, Sequential vs Index Scans, Create Table (UUID + JSONB), Add Column with Default, Create GIN Index (JSONB) and Create B-Tree Index CONCURRENTLY.

Other buttons: Format tidies the SQL, Copy copies it, Clear empties the editor, Cancel stops a running query and History opens your recent runs (the last 50 for this database, filterable by All, Success and Errors).

Safety rails

  • Destructive statements ask first. Dropping or truncating data shows a Destructive Operation Warning with the statement. Choose I understand, Execute Now only if you mean it; it cannot be undone automatically, so take a backup first. See Daily snapshots.
  • Time limit. A statement that runs longer than 30 seconds is stopped.
  • Result size. The result table shows up to 500 rows. Add LIMIT or filters for large tables.
  • Blocked commands. Anything that would reach the server itself, such as running programs, reading server files or other tenants' data, is refused.
  • Platform tables are hidden. Tables the platform manages for itself do not appear in the table list.
  • Your role matters. Viewer and Billing roles are read-only: write statements are refused, and reads run in a read-only transaction with one statement at a time. See Invite teammates and choose roles.

Queries run as your database's own application role, the same access your connection string has.

Good to know

  • Changes you run are real and immediate. Test on a copy or a separate database first.
  • For long jobs and migrations, use a regular or direct connection from your own tools. See Connection strings.
  • The Table Editor page lists tables and lets you browse rows; RLS Policies manages row-level security for publishable keys. See API keys.
  • The mobile app can run read-only SQL (5 seconds, 100 rows). See The PGBHub mobile app.

More guides in Console: databases