Dev Ops · n8n

Alert Engineers When Database Queries Start Running Slow

Fix performance before users feel it — monitor slow-query logs and alert the owning team when a query's runtime degrades.

difficulty Advancedsetup 40 minresult Slow queries are caught and routed to owners early, preventing them from degrading the whole app.
  1. 1

    Ingest Slow Queries

    Add a Webhook node receiving slow-query events with the statement and duration.

  2. 2

    Detect Degradation

    Add a Code node comparing runtimes to each query's baseline.

  3. 3

    Summarize the Issue

    Add an OpenAI node explaining the query and suggesting likely optimizations.

  4. 4

    Alert the Owner

    Add a Slack node routing the summary to the team owning that part of the schema.

  5. 5

    Activate and Test

    Activate the workflow with a slow test query. Confirm detection and alerting work.

Frequently asked questions

Won't occasional slow queries spam alerts?

Alert on sustained degradation versus baseline, not one-off slow runs under load.

Can it suggest indexes?

The AI can propose indexes or rewrites as a starting point for the engineer to validate.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.