Analytics Hub

Database monitoring and query performance metrics. Track system health and optimize performance.

Access

Admin Portal → Analytics (sidebar)

What You See

Header:

  • “Database Monitoring” title
  • Subtitle: “Query performance metrics and optimization insights”

Controls (top right):

  • Time Range selector (5m to 30 days)
  • Auto-refresh toggle (refreshes every 30 seconds)
  • Refresh button (manual refresh)

Overview Cards

Four main metrics displayed as cards:

Average Query Duration

How long database queries take on average.

Status colors:

  • Green: < 100ms (good)
  • Yellow: 100-500ms (warning)
  • Red: > 500ms (critical)

Lower is better.

Total Queries

Total number of database queries in selected time range.

Shows system load.

Query Errors

Number of failed queries.

Should be zero or very low.

High number indicates problems.

P95 Latency

95th percentile latency. 95% of queries are faster than this.

Better indicator than average for user experience.

Line graph showing query performance over time.

Metrics available:

  • Query Duration (ms)
  • Query Count
  • Query Errors
  • Rows Affected
  • P95 Latency
  • P99 Latency

Select metric from dropdown to change display.

Aggregation functions:

  • Average (avg)
  • Sum
  • Min/Max
  • Count
  • Percentiles (p50, p95, p99)

Endpoints Table

Shows performance breakdown by API endpoint.

Columns:

  • Endpoint path (e.g., /api/v1/patients)
  • Request count
  • Average duration
  • P95 latency
  • Error rate

Click column headers to sort.

Identify slow endpoints to optimize.

Slow Queries Table

Lists the 50 slowest database queries.

Columns:

  • SQL query (truncated)
  • Duration (ms)
  • Timestamp
  • Endpoint that triggered it
  • Parameters used

Status colors:

  • Green: < 100ms
  • Yellow: 100-500ms
  • Red: > 500ms

Use this to find queries that need optimization.

Click query to see full SQL and execution plan.

Time Ranges

Short term (real-time monitoring):

  • 5 minutes
  • 15 minutes
  • 30 minutes
  • 1 hour

Medium term (daily monitoring):

  • 3 hours
  • 6 hours
  • 12 hours
  • 24 hours

Long term (trend analysis):

  • 7 days
  • 30 days

Auto-Refresh

Toggle “Auto-refresh” to automatically refresh metrics every 30 seconds.

Useful for real-time monitoring during deployments or troubleshooting.

Use Cases

Daily Health Check

  1. Select “24 hours” time range
  2. Check overview cards:
    • Average duration < 100ms? Good
    • No query errors? Good
    • P95 latency reasonable? Good
  3. Review slow queries table
  4. Optimize any queries over 500ms

Performance Optimization

  1. Select “1 hour” time range
  2. Check endpoints table
  3. Sort by average duration (descending)
  4. Identify slowest endpoints
  5. Check slow queries for those endpoints
  6. Optimize queries or add indexes

Troubleshooting

  1. Enable auto-refresh
  2. Select short time range (5-15 minutes)
  3. Watch trends in real-time
  4. Identify spikes or anomalies
  5. Check slow queries during problem period

Permissions

Only admin users can access analytics.

Requires authentication.

Technical Details

Metrics collected from:

  • Database query logs
  • API request logs
  • Neon PostgreSQL metrics
  • Cloudflare Worker analytics

All metrics stored in database for historical analysis.

URL

https://intakepilot.com/admin (select Analytics from sidebar)