---
title: Connect with PgHero
description: Monitor your Lakebase Postgres database performance with PgHero, a performance monitoring tool for Postgres databases.
canonical_url: https://docs.databricks.com/gcp/en/oltp/projects/connect-pghero
---

# Connect with PgHero

PgHero is an open-source performance monitoring tool for Postgres that helps you find and fix data issues using a dashboard interface. You can use PgHero to monitor your Lakebase Postgres database performance, identify slow queries, analyze query patterns, and get actionable insights to optimize your database operations.

## <a id="when-to-use" />When to use PgHero

Use PgHero when you need:

* Simple, focused Postgres performance monitoring
* Identification of long-running queries
* Detection of tables that require vacuuming
* Identification of duplicate or missing indexes
* View of connections by database and user
* Query explanation, analysis, and visualization
* Lightweight monitoring without complex configuration

> [!NOTE]
>
> Lakebase Postgres doesn't currently support monitoring tools or platforms that require installing an agent on the Postgres host system.

## <a id="install" />Install PgHero

PgHero supports installation with [Docker](https://github.com/ankane/pghero/blob/master/guides/Docker.md), [Linux](https://github.com/ankane/pghero/blob/master/guides/Linux.md), and [Rails](https://github.com/ankane/pghero/blob/master/guides/Rails.md). This guide shows how to install PgHero with Docker and connect it to your Lakebase Postgres database.

Before you begin:

* Ensure that you have the [Monitor with pg\_stat\_statements](https://docs.databricks.com/gcp/en/oltp/projects/pg-stat-statements.md) extension installed. PgHero uses it for query stats.
* Ensure that you have Docker installed. See [Install Docker Engine](https://docs.docker.com/engine/install/) for instructions.
* For network configuration and allowlisting IP addresses when using a client-side firewall, see [Connection strings](https://docs.databricks.com/gcp/en/oltp/projects/connection-strings.md).

PgHero is available on [DockerHub](https://hub.docker.com/r/ankane/pghero/). To install it, run:

```bash
docker pull ankane/pghero
```

## <a id="connect-pghero" />Connect PgHero to Lakebase

1. Navigate to the Lakebase App by clicking the app switcher in the top right corner of your workspace.

2. Select your project.

3. Click **Connect** to open the database connection modal.

4. Copy the connection string.

5. Run this command, replacing `<your-connection-string>` with your Lakebase Postgres connection string:

   ```bash
   docker run -ti -e DATABASE_URL="<your-connection-string>" -p 8080:8080 ankane/pghero
   ```

6. Open [http://localhost:8080](http://localhost:8080) in your browser to access the PgHero dashboard.

For detailed connection string information, see [Postgres clients](https://docs.databricks.com/gcp/en/oltp/projects/postgres-clients.md).

## <a id="monitoring-features" />PgHero monitoring features

PgHero provides focused monitoring capabilities:

* **Slow queries**: Identify and analyze the slowest queries in your database
* **Query stats**: View query execution statistics and performance metrics
* **Index usage**: Monitor index efficiency and identify duplicate or unused indexes
* **Table stats**: Database table sizes, row counts, and vacuuming requirements
* **Connection stats**: View connections by database and user, and analyze connection pools
* **Query analysis**: Explain, analyze, and visualize query execution plans
* **Suggestions**: Automated recommendations for performance improvements
