Version: 1.0.0Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Date: 2026-01-16
Owner: Platform Team
Overview
This guide establishes the performance monitoring process for the Encore Health OS database. Regular monitoring ensures optimal performance and early detection of issues.Monitoring Schedule
Weekly Review (Every Monday)
Time: Monday morning (before business hours)Duration: 30-45 minutes
Owner: Platform Engineer on rotation Tasks:
- Run monitoring queries
- Review slow queries
- Check connection status
- Verify VACUUM status
- Document findings
- Create action items if needed
Monthly Review (First Monday of Month)
Time: First Monday of each monthDuration: 1-2 hours
Owner: Platform Team Lead Tasks:
- Complete weekly review
- Trend analysis (compare to previous month)
- Index usage audit
- Storage growth review
- Update baseline metrics if significant changes
Quarterly Review (January, April, July, October)
Time: First week of quarterDuration: 2-4 hours
Owner: Platform Team Tasks:
- Complete monthly review
- Full baseline capture
- Review archival candidates
- Performance optimization planning
- Update documentation
Weekly Review Process
Step 1: Access Supabase Dashboard
- Open Supabase Dashboard: https://app.supabase.com
- Select the Encore Health OS project
- Navigate to SQL Editor
Step 2: Run Monitoring Queries
Script Location:scripts/performance/monitoring-queries.sql
Run each query section and document results:
- Slow Queries - Queries with mean_exec_time > 1000ms
- Unused Indexes - Indexes with idx_scan = 0
- Connection Status - Active/idle connection counts
- VACUUM Status - Tables with high dead tuple counts
- Table Sizes - Track storage growth
- Long-Running Queries - Queries running > 30 seconds
- Cache Hit Ratio - Should be > 90%
Step 3: Analyze Results
Red Flags to Watch For:| Issue | Threshold | Action |
|---|---|---|
| New slow query | mean_exec_time > 1000ms | Investigate, add index if needed |
| Unused index | idx_scan = 0 after 4 weeks | Consider removal |
| High dead tuples | > 10% dead_tuple_percent | Schedule manual VACUUM |
| Low cache hit ratio | < 90% | Investigate memory usage |
| Growing table size | > 20% growth in week | Review for archival |
| Idle in transaction | > 10 connections | Investigate application issues |
Step 4: Document Findings
Create weekly review report: Location:reports/performance/weekly-review-YYYY-MM-DD.md
Template:
Step 5: Create Action Items
If issues are found:- Create GitHub issue for tracking
- Assign to appropriate team member
- Set priority based on impact
- Link to weekly review report
Monitoring Queries Quick Reference
Slow Queries
Connection Status
VACUUM Status
Database Size
Escalation Process
Level 1: Platform Engineer
- Weekly monitoring
- Minor optimizations
- Index additions
Level 2: Platform Team Lead
- Performance degradation > 20%
- New slow queries affecting users
- Connection pool issues
Level 3: Engineering Manager
- Database outage
- Critical performance issues
- Major architecture decisions
Tools & Resources
Scripts
| Script | Purpose | Location |
|---|---|---|
| assessment-queries.sql | Full assessment | scripts/performance/ |
| monitoring-queries.sql | Weekly monitoring | scripts/performance/ |
Documentation
| Document | Purpose | Location |
|---|---|---|
| SUPABASE_PERFORMANCE_RECOMMENDATIONS.md | Optimization guide | docs/migration/ |
| DATA_ARCHIVAL_PLAN.md | Archival strategy | docs/migration/ |
| baseline-metrics-template.md | Baseline capture | reports/performance/ |
Dashboards
| Dashboard | Purpose | Location |
|---|---|---|
| Supabase Dashboard | Database metrics | app.supabase.com |
| System Health | Application health | /settings/system-health/database |
Troubleshooting
Slow Query Investigation
- Get full query from pg_stat_statements
- Run EXPLAIN ANALYZE on the query
- Check for missing indexes
- Review table statistics (ANALYZE)
- Consider query rewrite if needed
High Connection Count
- Check for connection leaks in application
- Review idle connections
- Check for long-running transactions
- Verify connection pool settings
VACUUM Issues
- Check auto-vacuum settings
- Identify high-churn tables
- Schedule manual VACUUM during low-traffic
- Consider table partitioning for large tables
Maintenance Windows
Recommended Times:- Index creation: Sunday 2-4 AM
- Manual VACUUM: Sunday 4-6 AM
- Major migrations: Weekend with advance notice
- Notify team via Slack #platform channel
- Update status page if user impact expected
References
Last Updated: 2026-01-16
Review Schedule: Quarterly