Skip to product information

n8n Workflow: Triage PostgreSQL Blocking Sessions w/ Ollama & Telegram

n8n Workflow: Triage PostgreSQL Blocking Sessions w/ Ollama & Telegram

 (200+Reviews)
Regular price £69.99
Regular price £69.99 Sale price
SAVE Sold out
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
🔥
128+ Sold
Popular with n8n builders
âš¡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
n8n Workflow: Triage PostgreSQL Blocking Sessions w/ Ollama & Telegram

n8n Workflow: Triage PostgreSQL Blocking Sessions w/ Ollama & Telegram

Regular price £69.99
Regular price £69.99 Sale price
SAVE Sold out

Triage PostgreSQL blocking sessions automatically—and get human approval in Telegram

This n8n workflow checks your PostgreSQL instance every 5 minutes for blocking sessions, uses a pgvector knowledge base plus Ollama to recommend the best action, and sends an approval request via Telegram. If approved, it can terminate the blocking session—fully logged for auditability.

What this workflow does

  • Runs on a 5-minute schedule to continuously monitor for blocking/blocked PostgreSQL sessions.
  • Detects blocking scenarios using PostgreSQL system views (e.g., pg_stat_activity) and skips blockers that already have a recent proposal in the audit log.
  • Groups results by blocking session (PID) to create one triage item per blocker, summarizing wait time and the affected sessions.
  • Retrieves severity guidance from pgvector by generating an embedding with Ollama and searching a PostgreSQL pgvector knowledge base for the applicable severity criterion and supporting context.
  • Asks Ollama for a JSON recommendation (severity, action, motivation) based on the detected situation and retrieved criterion.
  • Sends a Telegram-ready approval message and waits for an approve/reject response.
  • Executes only after approval: if approved, calls a PostgreSQL function to terminate the blocking session and reports the outcome to Telegram; if rejected, logs the rejection to PostgreSQL.

Use cases

  • Reduce downtime during peak traffic by rapidly triaging PostgreSQL lock contention.
  • Standardize incident response using a knowledge base of severity criteria (via pgvector).
  • Give on-call teams a controlled, reviewable path to terminate blocking sessions from Telegram.

Technical details

  • PostgreSQL nodes: queries pg_stat_activity, reads kb.documenti, and writes proposal/rejection logs to ops.audit_log and ops.log_event.
  • Ollama: generates embeddings and produces a JSON proposal.
  • Telegram: approval/rejection messages and outcome notifications.
  • n8n nodes mentioned: if, set, code, postgres, telegram, sticky note.
View full details