Templates / Triage PostgreSQL blocking sessions with Ollama, pgvector and Telegram

Triage PostgreSQL blocking sessions with Ollama, pgvector and Telegram

Ready for 3.0

by Quirino Scaramastra · 1 views · created 2026-10-11 · DevOps, AI RAG

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This workflow has 15 nodes and runs on a schedule (every minute). Along the way it connects Postgres and Telegram.

How it runs

Trigger: On a schedule (every minute).

  1. Set Configuration Parameters (Edit Fields (Set)): sets 5 fields: chatId, approver, model…
  2. Query Blocking Sessions (Postgres): run a query
  3. Group by Blocking Session (Code): runs custom JavaScript code
  4. Post Situation Embedding (HTTP Request): calls an HTTP API (POST)
  5. Search Criteria in Vector DB (Postgres): run a query
  6. Compose Prompt for Ollama (Code): runs custom JavaScript code
  7. Post to Ollama API (HTTP Request): calls an HTTP API (POST)
  8. Validate Ollama Response (Code): runs custom JavaScript code
  9. Log Proposed Sessions (Postgres): run a query
  10. Approve or Reject via Telegram (Telegram): send and wait for a reply

…plus 4 more steps. See the full node list below.

Services it uses

PostgresTelegram

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (7)

From the author

Quick overview This workflow runs every 5 minutes to detect blocking PostgreSQL sessions, retrieves a severity criterion from a pgvector knowledge base, uses Ollama to propose an action, and sends the recommendation to Telegram for approval before optionally…

Excerpt from Quirino Scaramastra's description on n8n.io.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.