Grafana Cloud Enterprise Open source
Last reviewed: August 10, 2026

PostgreSQL data source

Query and visualize data from any PostgreSQL-compatible database. Build dashboards with the visual query builder or raw SQL, explore tables in real time, overlay annotations, and create alerts from the same connection. The data source works with self-managed PostgreSQL and managed services such as Amazon RDS, Amazon Aurora, Azure Database for PostgreSQL, and Google Cloud SQL.

Grafana ships with the PostgreSQL data source out of the box. It’s preinstalled in Grafana OSS and Enterprise, so you don’t need to install a plugin to add it. The data source is packaged as a standalone plugin that can update independently of Grafana releases.

Supported databases

This data source supports the following PostgreSQL-compatible databases:

  • PostgreSQL 9.0 and newer
  • Amazon RDS for PostgreSQL
  • Amazon Aurora PostgreSQL
  • Azure Database for PostgreSQL
  • Google Cloud SQL for PostgreSQL

Grafana recommends using the latest available version for your database for optimal compatibility.

Key capabilities

The PostgreSQL data source supports:

  • Time series queries: Visualize metrics over time using built-in time grouping macros.
  • Table queries: Display query results in table format for any valid SQL query.
  • EXPLAIN queries: Inspect query execution plans directly in the query editor.
  • Template variables: Create dynamic dashboards with variable-driven queries using the built-in variable query editor.
  • Annotations: Overlay events from PostgreSQL on your dashboard panels.
  • Alerting: Create alerts based on PostgreSQL query results (time series format only).
  • Macros: Simplify queries with built-in macros for time filtering and grouping.

Supported PostgreSQL data types

The PostgreSQL plugin uses the PGX driver for database connectivity. The following PostgreSQL data types are supported:

  • Numeric types: int2, int4, int8, float4, float8, numeric
  • String types: text, varchar, char, bpchar
  • Date/time types: timestamp, timestamptz, date, time, timetz, interval
  • Boolean: bool
  • JSON types: json, jsonb
  • Enumerated types: Custom enum types are returned as string values.
  • Other types: Types not explicitly mapped (such as arrays, composites, or custom domains) are returned as string values.

Get started

The following documents help you get started with the PostgreSQL data source:

Additional features

After you configure the PostgreSQL data source, you can:

  • Add annotations to overlay PostgreSQL events on your graphs.
  • Set up alerting rules based on your time series queries.
  • Use Explore to investigate your PostgreSQL data without building a dashboard.
  • Add transformations to process query results.

To see the PostgreSQL data source in action, explore the demo dashboard on Grafana Play:

Give it a try using Grafana Play
Give it a try using Grafana Play

With Grafana Play, you can explore and see how it works, learning from practical examples to accelerate your development. This feature can be seen on PostgreSQL Overview.

Plugin updates

Starting with Grafana v13.2, the PostgreSQL data source is a standalone plugin, preinstalled in both Grafana OSS and Enterprise. This enables more frequent updates independent of Grafana releases. Grafana automatically checks the plugin catalog and installs the latest version on each server restart.

To adjust this behavior:

  • Opt out of auto-updates: Set preinstall_auto_update to false in your configuration file.
  • Update manually: Update at any time from the Administration > Plugins page without restarting Grafana.

The standalone plugin requires Grafana 12.3.0 or later. The PostgreSQL data source bundled with Grafana 13.1 and earlier continues to work as before. These versions are unaffected by the externalization.

Users running Grafana 12.3.x through 13.1.x can install the standalone plugin from the plugin catalog if they want the latest features before upgrading to Grafana 13.2. To use the standalone plugin with Grafana 12.3.x through 13.1.x, add the following to your configuration file:

ini
[plugin.grafana-postgresql-datasource]
as_external = true

[plugins]
; Install the latest version on startup:
preinstall_sync = grafana-postgresql-datasource
; Or install a specific version:
; preinstall_sync = grafana-postgresql-datasource@<version>

The following databases use the PostgreSQL wire protocol and may work with this data source: