Date: 2026-01-16
Owner: Platform Team
Overview
This guide establishes the performance monitoring process for the Encore 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 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: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
Documentation
Dashboards
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