Triage PostgreSQL blocking sessions with Ollama, pgvector and Telegram
Ready for 3.0What 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).
- Set Configuration Parameters (Edit Fields (Set)): sets 5 fields: chatId, approver, model…
- Query Blocking Sessions (Postgres): run a query
- Group by Blocking Session (Code): runs custom JavaScript code
- Post Situation Embedding (HTTP Request): calls an HTTP API (POST)
- Search Criteria in Vector DB (Postgres): run a query
- Compose Prompt for Ollama (Code): runs custom JavaScript code
- Post to Ollama API (HTTP Request): calls an HTTP API (POST)
- Validate Ollama Response (Code): runs custom JavaScript code
- Log Proposed Sessions (Postgres): run a query
- 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
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)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Postgres
n8n-nodes-base.postgres - Code
n8n-nodes-base.code - HTTP Request
n8n-nodes-base.httpRequest - Telegram
n8n-nodes-base.telegram - If
n8n-nodes-base.if
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…