Skip to main content

Postgres data freshness monitoring with email alerts

Workflow preview

Workflow preview
100%
Postgres data freshness monitoring with email alerts preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Monitor Postgres Data Freshness and Email Alert If Stale This template monitors a set of tables inside a Postgres database to ensure they're getting updated. If the table hasn't been updated in 3 d...

Best for

  • Engineering automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.splitinbatches, n8n-nodes-base.aggregate, n8n-nodes-base.postgres, n8n-nodes-base.datetime, n8n-nodes-base.set, n8n-nodes-base.stickynote, n8n-nodes-base.filter

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Kevin.

Original n8n.io source

1.1 Workflow description

Title
Postgres data freshness monitoring with email alerts
Workflow name
Postgres data freshness monitoring with email alerts

Monitor Postgres Data Freshness and Email Alert If Stale

This template monitors a set of tables inside a Postgres database to ensure they're getting updated.

If the table hasn't been updated in 3 days (configurable), an email alert is sent containing the tables that are stale.

Requirements

You must have a Postgres database containing one or more tables that you'd like to monitor.

Each table to monitor must have a date or timestamp column that tracks when data was pushed.

For example, this might be:

  • A timestamp column if your table holds event/timeseries data
  • A last_updated column if your rows are expected to be modified

Usage

  1. Use this template
  2. Add your Postgres and email credentials
  3. Adjust the Produce tables + date columns node to produce pairs of [table, date_column] that should be monitored for freshness
    • 💁‍♂️ Note that a timestamp column also works
  4. (Optional) Adjust the Remove fresh tables node for your desired staleness window (default is 3 days, but you can adjust as you please)
  5. (Optional) Customize the Send alerts node to call whichever alerting workflow you please (I recommend my alerting workflow for easiest plug-and-play)

How it works

This template works by:

  1. Pulling the most recent row for each table
  2. Calculating how out-of-date each table is, in days
  3. Dropping fresh tables that have been updated within the past 3 days
  4. Sending an email alert with the stale tables that haven't been updated within the past 3 days

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 3 - Aggregate Stale Tables

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 4 - Get most recent row from table

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 5 - Calculate lag

Type / Role
n8n-nodes-base.dateTime - dateTime
Config choices
Version 2

Block 6 - Add back table name

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Remove fresh tables

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 9 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Produce tables + date columns

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Send alerts

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 12 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 13 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Postgres data freshness monitoring with email alerts
Complexity intermediate
Nodes 13
Categories Engineering
Author Kevin
Published 20 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6190/6190.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Postgres data freshness monitoring with email alerts do?

Monitor Postgres Data Freshness and Email Alert If Stale This template monitors a set of tables inside a Postgres database to ensure they're getting updated. If the table hasn't been updated in 3 d...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering use case.