PostgreSQL database browser

Compose Database-as-a-Service Help and Documentation
February 16, 2018 – 07:59 pm
Pgweb: a web-based PostgreSQL database browser written in Go

The SQL Query editor.The PostgreSQL data browser provides a management tool for your deployment in the Compose Console. Listed are all the databases in your deployment along with their size. The default database at deployment creation is named compose.

Database list on the data browser page.

If you wish to create other databases, click on the Create Database button in the upper-right. More information about database creation is covered in the PostgreSQL FAQ.

Clicking on a database name brings up a list of all the tables in that database, and a sidebar appears on the left for viewing and managing your data.

Click on a table name to manage the data within it. The tabs along the top provide a few useful table functions.

Query provides a SELECT statement for finding rows in the current table. The default query is to select LIMIT 20 rows from all rows in the table. The optional fields WHERE, ORDER BY, and OFFSET are toggled buttons and results are displayed below.

Running a SELECT command from the browser.

To add a new row to the table, click on the Insert Row button in the upper-right.

Adding a row through the browser.

If a table has a primary key, then it is possible to update the row or delete the row entirely by clicking on it. This is not available on tables without a primary key.

On the Indexes tab, there is a list of all the indexes on the current table and the option to drop the index. A new index can be created with the CREATE INDEX command.

Running CREATE INDEX through the browser.

The provided command automatically uses the CONCURRENTLY option, which does not lock out writes while the index is created. The option UNIQUE is toggled by button, and if you like to supply a name for the index click on the name button.

The Settings tab allows you to DROP TABLE on the current table and/or any views or other objects that depend on it. Please ensure you have backups before using the DROP TABLE button.

PL/pgSQL is installed by default, and SQL provides a query editor to run a single statement or series of statements. Once run, the individual statement outputs and results will be displayed below. For example, to create a new table in the database use CREATE TABLE and click the run button.

The SQL Query editor.

If you need to save a query for later use, name it and it will appear in a list on the right under Saved Queries. Clicking on the query name opens it in the editor where it can be modified, re-saved, or deleted.

Editing a saved query.

This list of packages can be added to PostgreSQL to extend functionality. By default the only installed package is PL/pgSQL. More information on extensions can be found in the PostgreSQL FAQ.

The information in Performance is a set of tabs based on the performance dashboard for PostgreSQL pgHero.

  • The Overview tab shows cache performance.
  • The Disk usage tab shows stats like the last VACUUM, autovacuum, ANALYZE, and automated ANALYZE command was run. It also displays the results from some of the database bloat and index bloat queries.
  • The Conncetions tab has information on current open connections to the database, the ability to kill them, and a list of active queries.
  • The Slow queries tab, with pg_stat_statements installed, will show queries slower than 20ms.

Roles lets you manage users for your database. Existing users and their permissions are listed, with the ability to Drop a user via button on the right. To create a new user, click on Add User in the upper-right. At the CREATE ROLE type the user name and password into the fields and set the roles with the LOGIN, CREATEDB, CREATEROLE buttons below.

The ultimate in administrative power, you can drop a database from here. Use wisely; clicking on the Delete Database button will delete the database and all the rows inside it.

Related Posts