PostgreSQL GUI with pgAdmin
pgAdmin is a graphical administration tool for PostgreSQL. It provides a browser-based interface for connecting to PostgreSQL servers, creating databases and tables, running SQL queries, viewing server activity, managing users, and performing backup or restore operations.
This tutorial explains the main parts of the pgAdmin interface and shows how to connect to a PostgreSQL server, browse database objects, and run a query with the Query Tool.
Open the PostgreSQL pgAdmin Interface
pgAdmin may be installed with PostgreSQL when it is selected during setup. It can also be installed separately. Open pgAdmin from the operating system application menu or desktop shortcut.
pgAdmin normally opens its interface in a web browser. The address may use a local host such as 127.0.0.1 with a dynamically assigned port. The exact port can differ between installations and sessions.

Depending on the pgAdmin version and configuration, you may be asked for a master password. This password protects credentials saved by pgAdmin. It is different from the password of a PostgreSQL database role unless you deliberately set both passwords to the same value.
Connect pgAdmin to a PostgreSQL Server
If a server connection is already registered, expand Servers in the Browser panel and enter the PostgreSQL role password when prompted. If no connection exists, register one manually.
- Right-click Servers in the Browser panel.
- Select Register, and then select Server.
- Enter a descriptive name on the General tab.
- Open the Connection tab.
- Enter the host name or IP address, port, maintenance database, username, and password.
- Select Save to create the connection.
| Connection field | Typical local value | Purpose |
|---|---|---|
| Host name/address | localhost or 127.0.0.1 | Identifies the computer running PostgreSQL. |
| Port | 5432 | Specifies the PostgreSQL server port. The configured value may differ. |
| Maintenance database | postgres | Provides an initial database for establishing the connection. |
| Username | postgres or another role | Identifies the PostgreSQL role used to connect. |
| Password | Your role password | Authenticates the PostgreSQL role. |
A connection failure does not necessarily mean pgAdmin is malfunctioning. Check that the PostgreSQL service is running, the host and port are correct, the role exists, and the server authentication settings permit the connection.
PostgreSQL pgAdmin Dashboard
After connecting to a server or selecting a database, pgAdmin displays a dashboard for the selected object.

The dashboard can show server activity and database statistics such as active sessions, transactions, tuples, and input/output information. The available charts and statistics depend on the selected object, PostgreSQL version, permissions, and pgAdmin version.
Use the dashboard to observe activity, but use the Query Tool or PostgreSQL monitoring views when you need exact SQL-based diagnostics.
pgAdmin Menu Bar and Administration Tools

The exact menus can vary by pgAdmin release, selected object, and user permissions. Common menu groups include the following.
- File provides interface preferences, layout controls, and application-level options.
- Object provides actions for the object selected in the Browser panel. Depending on the selection, it can be used to create or manage databases, schemas, tables, roles, and other PostgreSQL objects.
- Tools provides utilities such as the Query Tool, backup, restore, import/export, maintenance, and server status tools. Available commands depend on the selected object.
- Help provides access to pgAdmin documentation, information about the installed version, and other support resources.
Browse PostgreSQL Databases, Schemas, and Tables in pgAdmin
The Browser panel displays registered servers and their database objects in a tree structure. Expand each node to move through the PostgreSQL object hierarchy.

A common navigation path is:
Servers
└── PostgreSQL Server
└── Databases
└── database_name
└── Schemas
└── public
├── Tables
├── Views
├── Functions
└── Sequences
Right-click an object to open actions that apply to it. For example, right-clicking Tables can provide an option to create a table, while right-clicking an individual table can provide options to view or edit data.
The Browser panel may not immediately display objects created by another session. Right-click the relevant node and select Refresh when an expected database, schema, or table is missing.
pgAdmin Object Tabs: Dashboard, Properties, SQL, and Statistics

Selecting an object in the Browser panel opens tabs that describe or manage that object. The available tabs depend on whether you selected a server, database, schema, table, view, role, or another PostgreSQL object.
- Dashboard displays activity and performance information for supported server and database objects.
- Properties displays configuration details such as name, owner, encoding, privileges, or object-specific settings. Editable fields depend on permissions.
- SQL displays SQL that represents the selected object’s definition. This is useful for understanding how pgAdmin maps graphical settings to SQL statements.
- Statistics displays collected database statistics such as scans, rows inserted, rows updated, rows deleted, or object size where available.
- Dependencies identifies objects required by the selected object.
- Dependents identifies objects that rely on the selected object.
Statistics are based on PostgreSQL’s internal statistics system and may not update instantly after every operation. Their availability also depends on the object type and permissions of the connected role.
Run SQL with the PostgreSQL pgAdmin Query Tool
The Query Tool is the main pgAdmin workspace for writing and executing SQL against a selected database.
- Expand the server and select the database on which the query should run.
- Open Tools and select Query Tool. You can also use the context menu or toolbar when the option is available.
- Enter a SQL statement in the query editor.
- Select the execute button to run the statement.
- Review the result grid, messages, execution time, or error details in the output area.

The following query displays the PostgreSQL server version used by the current connection.
SELECT version();
To verify the database and role associated with the Query Tool session, run:
SELECT current_database(), current_user;
The result grid displays queries that return rows. Statements such as CREATE TABLE, INSERT, or UPDATE may instead report their status in the messages area.
Create and Check a Table in pgAdmin
You can create PostgreSQL objects through pgAdmin dialogs or by running SQL. SQL is often easier to repeat, review, and place under version control.
CREATE TABLE employees (
employee_id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
employee_name varchar(100) NOT NULL,
department varchar(100)
);
After executing the statement, refresh the Tables node under the target schema. The new employees table should appear in the Browser panel.
Insert and retrieve a sample row with the following statements.
INSERT INTO employees (employee_name, department)
VALUES ('Anita', 'Sales');
SELECT employee_id, employee_name, department
FROM employees;
View and Edit PostgreSQL Table Data in pgAdmin
To inspect table rows without writing a query, right-click a table and use the available View/Edit Data option. pgAdmin opens a data grid containing rows from the selected table.
Editing through the grid is convenient for small administrative changes. For repeatable changes, production systems, or updates affecting many rows, use explicit SQL statements and include an appropriate WHERE condition.
A table generally needs a primary key or another uniquely identifiable row for reliable editing through a graphical data grid.
PostgreSQL Backup, Restore, and Import Tools in pgAdmin
pgAdmin provides graphical access to several PostgreSQL command-line utilities. The relevant actions are normally available from the context menu of a server, database, schema, or table.
- Backup creates an archive or plain SQL backup, depending on the selected format and options.
- Restore restores compatible archive backups into a PostgreSQL database.
- Import/Export Data transfers table data using formats such as CSV.
- Maintenance provides access to operations such as
VACUUM,ANALYZE, andREINDEXwhere supported.
Backup and restore commands require the appropriate PostgreSQL utilities to be installed and correctly configured in pgAdmin. They also require sufficient database permissions and file-system access.
Common pgAdmin Connection and Query Problems
| Problem | What to check |
|---|---|
| Connection refused | Confirm that PostgreSQL is running, the host and port are correct, and the server is listening for the connection. |
| Password authentication failed | Verify the PostgreSQL role name and password. The pgAdmin master password is not automatically the database password. |
| Database or table is missing | Refresh the Browser node and confirm that you are connected to the expected server and database. |
| Permission denied | Connect with a role that owns the object or has the required privilege. Avoid using a superuser for routine application work. |
| Query Tool opens on the wrong database | Close the tab, select the intended database in the Browser panel, and open a new Query Tool session. |
| Backup or restore utility not found | Configure the PostgreSQL binary path in pgAdmin preferences and confirm that the installed utility version is compatible with the server or backup. |
PostgreSQL GUI Security Practices
- Use separate PostgreSQL roles for administration, applications, reporting, and read-only access.
- Do not expose the pgAdmin web interface publicly without appropriate authentication, encryption, firewall rules, and access controls.
- Avoid saving database passwords on shared computers.
- Review generated SQL before applying changes to production databases.
- Back up important databases before destructive schema changes or bulk data updates.
- Use the minimum privileges required for each task.
PostgreSQL pgAdmin Frequently Asked Questions
Is pgAdmin the PostgreSQL database server?
No. PostgreSQL is the database server, while pgAdmin is a separate graphical client and administration tool that connects to PostgreSQL.
Is the pgAdmin master password the same as the PostgreSQL password?
No. The master password protects credentials stored by pgAdmin. A PostgreSQL password authenticates a database role on a PostgreSQL server.
What is the default PostgreSQL port in pgAdmin?
The commonly used PostgreSQL server port is 5432, but administrators can configure PostgreSQL to use another port. The local browser port used to display pgAdmin is unrelated to the PostgreSQL server port.
Why does a new PostgreSQL table not appear in pgAdmin?
The Browser tree may need to be refreshed. Also confirm that the table was created in the expected database and schema and that the connected role has permission to see it.
Can pgAdmin run SQL scripts?
Yes. Open the Query Tool for the required database, enter or load the SQL script, and execute it. Review transaction behavior and object permissions before running scripts that modify data or schema objects.
PostgreSQL pgAdmin Editorial QA Checklist
- Confirm the tutorial distinguishes the pgAdmin master password from a PostgreSQL role password.
- Confirm connection instructions identify the host, PostgreSQL port, maintenance database, username, and password separately.
- Confirm Browser paths use the correct hierarchy of server, database, schema, and table.
- Confirm Query Tool examples are executed against the intended database and use valid PostgreSQL syntax.
- Confirm backup, restore, and import instructions do not imply that permissions or PostgreSQL utilities are optional.
Using pgAdmin as a PostgreSQL GUI
pgAdmin provides a graphical way to register PostgreSQL servers, browse databases and schemas, inspect object definitions, run SQL, view activity, and perform common administrative operations. The Browser panel is used to select objects, while the Query Tool is used for direct SQL work.
For additional PostgreSQL topics, continue with the PostgreSQL Tutorial.
TutorialKart.com