Every SaaS company has a handful of numbers that matter more than everything else: daily signups, trial conversions, churn events, MRR. When those numbers move in the wrong direction, you want to know immediately — not when someone happens to pull a report tomorrow morning, and not from a support ticket a customer sends after they've already churned.
The problem is that most SaaS products store these metrics in a database, but the alerting layer lives somewhere else — or doesn't exist at all. Analytics tools show you historical dashboards. CRMs track deals. Payment processors send receipts. But the ground truth about what's actually happening — user activity, subscription status, cancellations, usage patterns — lives in your application database.
This guide covers how to build a real-time alerting system on top of your database for the SaaS metrics that actually matter, without stored procedures, DBA involvement, or complex infrastructure.
Why Your Database Is the Right Source for SaaS Alerts
Before discussing how, it's worth being clear about why your database — and not your analytics tool, your payment processor, or your CRM — is the right place to pull alert data from.
It has the most current data. Analytics platforms like Mixpanel, Amplitude, or Segment are typically delayed by minutes to hours due to event ingestion pipelines. Your application database is updated the moment something happens.
It has the data that doesn't get tracked elsewhere. Trial-to-paid conversion rates, feature usage frequency, account-level activity — this data lives in your app database. It's rarely exported in full to analytics tools.
It captures what actually happened, not what was supposed to happen. A Stripe webhook for a failed payment might not fire if there's a network issue. Your database subscriptions table has the current state regardless.
It supports custom logic. Your business definitions of "churned," "active," or "at risk" are specific to your product. A database query can implement those definitions exactly.
The Four SaaS Metrics Worth Alerting On
Not all metrics need real-time alerts. Focus on the ones where a delay in knowing costs you money or a user.
1. Daily Signup Drops
A sharp drop in signups is one of the earliest signals that something is broken — a landing page down, a funnel change that backfired, or a tracking issue in your acquisition channels.
-- Count signups in the last 24 hours
SELECT COUNT(*) AS signups_today
FROM users
WHERE created_at >= NOW() - INTERVAL 1 DAY;Alert threshold: if signups_today drops more than 30% below the 7-day average, send a Slack message.
2. Trial Conversion Drops
Trial conversions are a lagging indicator but catching a week-over-week drop early gives you time to investigate before the pattern compounds.
-- Trial-to-paid conversion rate for the past 7 days
SELECT
COUNT(CASE WHEN plan_type = 'paid' THEN 1 END) * 100.0 /
NULLIF(COUNT(*), 0) AS conversion_rate_pct
FROM subscriptions
WHERE trial_ended_at BETWEEN NOW() - INTERVAL 14 DAY AND NOW() - INTERVAL 7 DAY;3. Churn Events
A cancellation the moment it happens — not at end-of-month reporting.
-- Subscriptions cancelled in the last hour
SELECT
s.id,
u.email,
s.plan_type,
s.cancelled_at,
s.mrr
FROM subscriptions s
JOIN users u ON s.user_id = u.id
WHERE s.cancelled_at >= NOW() - INTERVAL 1 HOUR
AND s.status = 'cancelled';Alert on every row returned: "Account [email] on [plan] cancelled — $[mrr] MRR at risk."
4. High-Value Account Inactivity
Accounts that stop using your product before they formally cancel are often more urgent than the cancellation itself. Catching inactivity early gives you a window to intervene.
-- Paid accounts with no activity in the last 7 days
SELECT
u.email,
u.company_name,
s.plan_type,
MAX(e.created_at) AS last_activity
FROM users u
JOIN subscriptions s ON s.user_id = u.id
LEFT JOIN events e ON e.user_id = u.id
WHERE s.status = 'active'
AND s.plan_type != 'free'
GROUP BY u.id, u.email, u.company_name, s.plan_type
HAVING last_activity < NOW() - INTERVAL 7 DAY
OR last_activity IS NULL;Traditional Approaches and Their Limitations
Before AI-powered database workflow tools, teams typically did one of three things:
Option 1: Database triggers
A trigger fires a stored procedure on INSERT or UPDATE, which calls an external API. This works but requires DBA access to set up, lives inside the database itself (making it hard to audit or version-control), and breaks when the external API changes.
Option 2: Custom cron jobs
A scheduled Python or Node.js script queries the database on a schedule and sends alerts. This is the most common approach for engineering teams. The problem: every new alert requires code changes, deployments, and someone to maintain the script. It also doesn't scale well — ten alerts become twenty, twenty become a maintenance burden.
Option 3: Analytics platform alerts
Most BI tools can send alerts when a metric crosses a threshold. But as described above, they're working on delayed, incomplete data and can't implement your exact business logic.
Each of these options solves part of the problem but introduces friction that makes it impractical for non-engineering teams to own their own alerts.
How AI for Database Handles SaaS Metric Alerts
AI for Database's action workflows are built specifically for this pattern: connect to your database, define a condition in plain English or SQL, choose an action (Slack, email, webhook), and set a schedule.
Here's how you'd set up each of the four alerts above:
Signup drop alert:
#growth → "⚠️ Signups down — only [N] in the last 24 hours vs [avg] 7-day average"Churn alert:
High-value inactivity alert:
No stored procedures. No cron jobs to deploy. No engineering ticket required to add a new alert.
Setting Up Threshold-Based Alerts
Threshold alerts work well when you have a clear numeric cutoff. But SaaS metrics are seasonal and variable — a Monday in January looks different from a Monday in June.
A more reliable pattern is relative thresholds: compare today's metric to a rolling average.
-- Is today's signup count more than 25% below the 14-day average?
WITH daily_signups AS (
SELECT
DATE(created_at) AS signup_date,
COUNT(*) AS signups
FROM users
WHERE created_at >= CURDATE() - INTERVAL 15 DAY
GROUP BY DATE(created_at)
),
averages AS (
SELECT
AVG(signups) AS avg_14d
FROM daily_signups
WHERE signup_date < CURDATE()
)
SELECT
d.signups AS today,
a.avg_14d,
(d.signups < a.avg_14d * 0.75) AS is_below_threshold
FROM daily_signups d, averages a
WHERE d.signup_date = CURDATE();If is_below_threshold = 1, fire the alert. This is much less noisy than a fixed number because it adapts to your growth trajectory.
Webhook Integration for Custom Actions
Beyond Slack and email, AI for Database can fire webhooks when conditions are met. This opens up integrations with anything that has an API:
The webhook fires a POST request with a JSON payload that includes the query results. Your receiving endpoint can then take any action.
Example payload for a churn alert:
{
"event": "subscription_cancelled",
"account": {
"email": "customer@example.com",
"plan": "pro",
"mrr": 299,
"cancelled_at": "2026-03-20T14:32:00Z"
}
}Avoiding Alert Fatigue
The biggest risk with database alerting isn't missing signals — it's too many signals. An alert that fires ten times a day trains people to ignore it.
Practical rules for SaaS database alerts:
Alert on changes, not states. Instead of "MRR is below $50,000," alert on "MRR dropped more than 5% from yesterday." You don't need to be told the same thing every hour.
Set minimum thresholds. Only fire a churn alert if the cancelled MRR exceeds a floor (e.g., $100/month). Low-value churn is expected and doesn't need immediate attention.
Route by severity. High-severity alerts (payment failures, complete outages in signups) go to Slack with an @here. Low-severity alerts (single account inactive) go to a digest email once a day.
Review weekly. Look at which alerts fired and which ones triggered action. Kill alerts that consistently fire without producing any useful response.
Start With Two Alerts
If you're setting up database alerting for the first time, resist the urge to build ten alerts at once. Start with the two that would be most immediately useful:
Get those working reliably, then expand. The discipline of starting small and only adding alerts that produce action is what separates a useful alerting system from a noisy one.
Try AI for Database free at aifordatabase.com — connect your database and set up your first workflow alert in under ten minutes.