> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL Vector source

Get more insights into the operation of your PostgreSQL databases with our Vector PostgreSQL integration.

[Vector](https://vector.dev) has a [PostgreSQL source][source] that collects metrics from PostgreSQL databases. When these PostgreSQL metrics are sent to AppSignal, the metrics from this Vector source will be shown in our PostgreSQL automatic dashboard. This dashboard will tell you more about:

* how many records were selected, inserted, updated and deleted.
* how many transactions were committed and rolled back.
* how many deadlocks were detected.
* how many temporary files were written during the operation of the database.

## Configuration

<Tip>
  If you've not set up Vector yet, please see the [Vector configuration
  section](/vector#configuration) for more information, such as which Push
  API key to use.
</Tip>

To send Vector PostgreSQL data to AppSignal you need to configure the PostgreSQL source and AppSignal sink in your Vector configuration. We'll be using the TOML configuration file as an example.

1. Add a new source of the [`postgresql_metrics` source][source] type to your configuration file. The name of the source is the part following the dot in `sources.postgresql`, not the `postgresql_metrics` type.

<CodeGroup>
  ```toml TOML theme={null}
  [sources.postgresql]
  type = "postgresql_metrics"
  ```
</CodeGroup>

2. Configure the source's `endpoints` option with the PostgreSQL connection string for your database. Replace the variables (`$VARIABLE_NAME`) with the values for your database, or pass them as environment variables.

<CodeGroup>
  ```toml TOML theme={null}
  [sources.postgresql]
  type = "postgresql_metrics"
  endpoints = ["postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB"]
  ```
</CodeGroup>

3. Update `inputs` in the `appsignal` sink to include the name of the `postgresql_metrics` source:

<CodeGroup>
  ```toml TOML theme={null}
  [sinks.appsignal]
  inputs = ["postgresql"]
  # Other config
  ```
</CodeGroup>

Shown below is an example `vector.toml` configuration file. Your [Vector configuration method][vector config] may be different.

<CodeGroup>
  ```toml TOML theme={null}
  [sources.postgresql]
  type = "postgresql_metrics"
  endpoints = ["postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$POSTGRES_DB"]

  [sinks.appsignal]
  type = "appsignal"
  inputs = ["postgresql"]
  push_api_key = "Your app-level Push API key"
  ```
</CodeGroup>

[source]: https://vector.dev/docs/reference/configuration/sources/postgresql_metrics/

[vector config]: https://vector.dev/docs/reference/configuration/
