---
title: Deploy PgDog with AI on Blossom
url: "/deploy/pgdog/"
canonical_url: https://blossom88.com/deploy/pgdog/
markdown_url: https://blossom88.com/deploy/pgdog.md
summary: Run a private PostgreSQL connection pool and test concurrent transactions
  against one database.
categories:
- deployment
- databases
stack:
- Rust
- PostgreSQL
---

# Deploy PgDog with AI on Blossom

[PgDog](https://github.com/pgdogdev/pgdog) pools PostgreSQL connections.
In transaction mode, several clients can take turns using a smaller set
of database connections.

## Ask Your Agent

> **Ask your AI agent:** Deploy PgDog on Blossom and help me test connection pooling with PostgreSQL.
>
> Follow this guide: https://blossom88.com/deploy/pgdog/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#connect-your-provider).

## How It Runs

| Part | Role | Where |
|---|---|---|
| PgDog | Pool PostgreSQL connections in transaction mode | Private Service on App Capacity |
| PostgreSQL | Store the sample data | Blossom Managed PostgreSQL |

## Deploy PgDog

Use the [official PgDog image](https://docs.pgdog.dev/installation/) and a
private PostgreSQL database. Keep the pooler private and connect your
client over the Environment's private network.

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

Run one PgDog Container on port `6432`. Configure the PostgreSQL primary
in `pgdog.toml` and provide the database role in `users.toml` using
Blossom secrets. Keep the admin password private. PgDog is distributed
under the [AGPL 3.0 license](https://github.com/pgdogdev/pgdog/blob/v0.1.66/LICENSE).

    blossom environment:deploy --id environment-100 --follow

</details>

## Run Concurrent Transactions

Point a PostgreSQL client at PgDog. Start with a one-connection pool
to see concurrent clients share it. Commit some sample writes, then
roll back a separate write and check that it is absent.

> **Ask your AI agent:** Help me run concurrent transactions through PgDog and verify a rolled-back write stays out of the database.

> Follow this guide: https://blossom88.com/deploy/pgdog/



![Route six clients through one PostgreSQL connection.](/deploy/assets/images/pgdog/concurrent-transactions.webp)

## Reopen the Rows After an Update

Replace the PgDog Container, reconnect and query the same sample rows.
The PostgreSQL database holds the committed data.

> **Ask your AI agent:** Replace PgDog and check that the same committed rows are still there.

> Follow this guide: https://blossom88.com/deploy/pgdog/



![Open the same committed rows after replacing PgDog.](/deploy/assets/images/pgdog/transactions-after-replacement.webp)

## What You Get

A private pooler you can point your PostgreSQL clients at while keeping
their data in Managed PostgreSQL.

## What You Get

- A private PostgreSQL connection pool
- Concurrent transactions against a sample table
- The same committed rows after replacing PgDog

Tested on Blossom: Six concurrent clients used one PostgreSQL connection. The same 18 committed rows reopened after replacement.
