Skip to main content

Connect with pgAdmin

Beta

Lakebase Postgres (Autoscaling Beta) is the next version of Lakebase, available for evaluation only. For production workloads, use Lakebase Public Preview. See choosing between versions to understand which version is right for you.

pgAdmin is a popular open source graphical administration tool for PostgreSQL. It provides a visual interface for managing databases, running queries, viewing data, and monitoring database performance. You can use pgAdmin to connect to your Lakebase database, perform administrative tasks, and monitor real-time performance metrics.

Prerequisites

  • pgAdmin 4 installed on your system
  • A Lakebase database project with a Postgres role configured
note

We recommend using native Postgres password authentication when connecting with pgAdmin. Native Postgres passwords don't expire hourly like OAuth tokens, making them better suited for applications that cannot refresh credentials frequently. See Authentication overview for details about authentication methods.

Install pgAdmin

If you don't have pgAdmin installed, download and install it from the pgAdmin website.

Understanding the connection string

Lakebase provides a connection string that contains all the information needed to connect. Here's how to parse it:

postgresql://role_name:password@ep-abc-123.databricks.com/databricks_postgres?sslmode=require
^ ^ ^ ^
user -| | |- hostname |- database
|
|- password

When configuring pgAdmin, you'll enter these components into separate fields. For more details about connection strings, see Understanding connection strings.

Connect to your database

  1. Get connection details from Lakebase:

    • Navigate to the Lakebase App and select your database project
    • Click Connect to open the database connection modal
    • Select the branch, compute, and database you want to connect to
    • Select a Postgres role from the dropdown (we recommend using a native Postgres role with password authentication). If you need to create a role, see Create a native Postgres password role.
    • Note the connection details
  2. Create a server connection in pgAdmin:

    • Open pgAdmin
    • From Quick Links on the main page, select Add New Server.

    pgadmin add server

  3. Configure the General tab:

    • Name: Enter a descriptive name for your connection (e.g., "My Lakebase Project")

    pgadmin register server

  4. Configure the Connection tab:

    • Host name/address: Enter your compute endpoint hostname (e.g., ep-abc-123.databricks.com)
    • Port: 5432
    • Maintenance database: Enter your database name (e.g., databricks_postgres)
    • Username: Enter your Postgres role name (e.g., role_name)
    • Password: Enter your Postgres role password
    • Save password: Check this box to save the password

    The example shown below uses a Postgres role named pgadmin.

    pgadmin connection details

  5. Configure SSL on the Parameters tab:

    • SSL mode: Select Require

      pgadmin parameters tab ssl

  6. Save the connection:

    • Click Save to create the connection

Your Lakebase database will now appear in the left sidebar under Servers. You can expand it to view databases, schemas, tables, and other database objects.

pgadmin servers view

Using pgAdmin

Once connected, you can:

  • Browse database objects: Expand your server in the left sidebar to view databases, schemas, tables, views, functions, and more
  • Run queries: Right-click your database and select Query Tool to open the SQL editor
  • View data: Right-click a table and select View/Edit Data to browse table contents
  • Manage schemas: Create, modify, or delete database objects using the graphical interface
  • Monitor performance: View statistics, active sessions, and query performance

Basic operations in pgAdmin

After you connect, you can perform common tasks:

  • Run SQL queries: Open the Query Tool for your database, enter SQL commands, and execute them.
  • Manage tables: Expand your database → Schemas → public → Tables. You can create new tables or manage existing ones.
  • Import and export data: Right-click a table and choose Import/Export to load data from CSV or export table data to a file.

Monitoring with pgAdmin

With pgAdmin, you can monitor real-time activity for a variety of metrics including:

  • Active sessions: Total, Active, and Idle sessions
  • Transactions per second: Transactions, Commits, Rollbacks
  • Tuples in: Inserts, Updates, Deletes
  • Tuples out: Fetched, Returned
  • Block I/O: For shared buffers
note

Lakebase Postgres currently doesn't support the system_stats extension required to use the System Statistics tab in pgAdmin. Also note that pgAdmin, while active, polls your database for statistics, which doesn't allow your compute to suspend as it normally would when there's no other database activity.

pgAdmin monitoring features

pgAdmin provides additional monitoring capabilities:

  • Dashboard: Real-time server activity and performance metrics
  • Statistics: Database and table statistics, including row counts and disk usage
  • Sessions: Active connections and session management
  • Locks: Current database locks and blocking queries
  • Prepared statements: View and analyze prepared statement cache
  • Query tool: Execute queries with detailed execution plans and performance analysis

Connection security

Lakebase requires that all connections use SSL/TLS encryption. Ensure the SSL mode is set to Require on thye Parameters tab of your server configuration.

For more information about connection strings and authentication options, see Connect to your database project.