• /
  • Log in
  • Free account
Instant Observability (I/O)Psycopg2


New Relic’s Psycopg2 quickstart provides valuable visibility into Python applications interfacing with PostgreSQL databases via a series of visual dashboards and alerts that monitor connections, CPU utilization, memory, and more.
Install quickstartView repo

What's included



High CPU Utilization

This alert is triggered when the CPU Utilization is above 90%.


Memory Usage

This alert is triggered when Memory usage is above 90%


Apdex Score

This alert is triggered when the Apdex score is below 0.5 for 5 minutes


Transaction Errors

This alert is triggered when the the transactions fail more than 10% of the time in 5 minutes.


Psycopg2 installation docs

Psycopg is the most popular PostgreSQL database adapter for the Python programming language.


Monitoring Psycopg2

Psycopg2 is a popular PostgreSQL database adapter for Python. It is an API which allows Python to interface with Postgres databases. It has a number of features such as thread safety, and it was designed with concurrency in mind(it support large numbers of simultaneous operations to a single database).

While thread safety protects against a lot of common parallel programming errors, there are still things that can go wrong. Parallel connections increase memory and CPU utilization and can cause difficult-to-catch bugs. The Psycopg2 quickstart automatically monitors your Psycopg2 instances and provides instantaneous feedback on key metrics that affect performance.

New Relic Psycopg2 quickstart features

The Quickstart offers a number of visual dashboards that display the following data:

  • CPU Utilization
  • Memory heap used
  • Garbage collection CPU time
  • Top 5 slowest transactions
  • Throughput reports
  • Most popular transactions
  • And more…

It also offers alerts which will notify you when any of the metrics you’re monitoring fall into a critical range, or if an error arises. Alerts include

  • Apdex score
  • CPU utilization
  • Transaction error

New Relic - The complete Psycopg2 dashboard tool

Any Python application which interfaces with a Postgres database is likely to use Psycopg2. This spans a huge array of applications from web backends to machine learning tools to general data stores. Regardless of the specific application, working with Psycopg2 on large-scale projects requires instantiating tens to hundreds to thousands of simultaneous connections with the database. When this many connections are active at once, applications running Psycopg2 become prone to slowdowns or failure.

For example, the New Relic dashboards and alerts relating to CPU utilization can provide notifications when a CPU running Psycopg2 nears full capacity. This can be used as a diagnostic tool to identify which sections of an application might need refinements or refactoring.

Another great tool are the alerts on transaction errors. This alert quick catches errors related to database transactions before they derail the rest of an application. They also make the debugging process much quicker and simpler as visibility into the sources of errors is available immediately.

Create issue
Copyright © 2021 New Relic Inc.