Database Management Guide: Monitoring, Scaling & Optimization | Nife Docs

Monitor your databases, scale resources, perform updates, and maintain performance.


Accessing Database Management#

From Dashboard#

  1. Go to Databases page
  2. Click database name
  3. See management options

Available Options#

  • Overview: Database status and metrics
  • Performance: Metrics and monitoring
  • Backups: Backup management
  • Settings: Configuration options
  • Logs: Activity and error logs

Monitoring Performance#

Key Metrics#

CPU Usage

  • Percentage of CPU being used
  • Green (< 70%): Healthy
  • Yellow (70-85%): Monitor
  • Red (> 85%): Performance issue

Memory Usage

  • Percentage of RAM used
  • Green (< 70%): Healthy
  • Yellow (70-80%): Monitor
  • Red (> 80%): Scale needed

Disk Usage

  • Percentage of storage used
  • Green (< 70%): Healthy
  • Yellow (70-80%): Plan scaling
  • Red (> 90%): Critical, scale immediately

Connections

  • Current active connections
  • Compare to max connections
  • If near limit, scale up

Query Performance

  • Average query time
  • Slow queries count
  • Long-running queries

Reading the Dashboard#

Healthy Database:

  • CPU < 70%
  • Memory < 70%
  • Disk < 80%
  • Few slow queries
  • Active connections normal

Warning Signs:

  • CPU > 85% consistently
  • Memory > 80%
  • Disk > 85%
  • Many slow queries
  • Connection limit approaching

Critical Issues:

  • CPU at 100%
  • Memory at 100%
  • Disk > 95%
  • Queries failing
  • Connection refused errors

Scaling Your Database#

Vertical Scaling (More Power)#

Increase CPU and memory:

When to scale:

  • CPU consistently > 80%
  • Memory consistently > 80%
  • Queries getting slow
  • Response times increasing

How to scale:

  1. Go to Settings
  2. Click Change Plan
  3. Select larger plan
  4. Apply changes

Downtime: Usually 1-5 minutes

Horizontal Scaling (More Storage)#

Increase storage capacity:

When to scale:

  • Disk usage > 70%
  • Disk usage growing rapidly
  • Approaching storage limit
  • Planning for future growth

How to scale:

  1. Go to Settings
  2. Click Increase Storage
  3. Select new size
  4. Apply changes

Downtime: Usually none (online scaling)

Storage tiers:

  • 1 GB โ†’ 100 GB available
  • Scale in increments
  • One-way increase (can't decrease)

Read Replicas#

Add read-only copies for scale-out:

When to use:

  • Read traffic overwhelming primary
  • Need distributed reads
  • High-availability needed
  • Multiple regions wanted

Benefits:

  • Scales read traffic
  • High availability
  • Disaster recovery
  • Low latency for reads

Cost: Additional replicas increase cost


Database Updates#

Version Upgrades#

Update to newer database versions:

Available Upgrades:

  • Minor versions (7.5 โ†’ 7.6)
  • Major versions (14 โ†’ 15)
  • Check compatibility first

Before Upgrading:

  1. Test in staging environment
  2. Backup current database
  3. Review breaking changes
  4. Plan maintenance window

Upgrade Process:

  1. Go to Settings
  2. Click Upgrade Version
  3. Select new version
  4. Confirm compatibility
  5. Schedule upgrade

Downtime: Usually 5-30 minutes

Security Patches#

Automatic security updates applied:

What happens:

  • Security patches applied automatically
  • Usually no downtime
  • Transparent to applications
  • Logged in activity logs

You can:

  • Schedule preferred time
  • View patch history
  • Enable/disable auto-patching

Backup Management#

Automatic Backups#

Included with all databases:

Backup Schedule:

  • Daily automatic backups
  • Weekly full backups
  • Monthly long-term backups

Retention:

  • 7-day backups: 7 days
  • 30-day backups: 30 days
  • 1-year backups: 1 year

Coverage:

  • Full data backup
  • Schema backup
  • Configuration backup

Manual Backups#

Create on-demand backups:

When to create:

  • Before major changes
  • Before version upgrade
  • Before scaling operations
  • Before maintenance
  • Before application changes

How to create:

  1. Go to Backups
  2. Click Create Backup
  3. Add description
  4. Confirm

Time taken: 5-60 minutes depending on size

Backup Storage#

Where backups are stored:

Locations:

  • Same region as database (default)
  • Multiple regions available
  • Encrypted storage
  • Geo-redundant options

Cost: Usually included in database cost


Recovery Options#

Point-in-Time Recovery (PITR)#

Restore to any point in time:

Availability:

  • Last 7 days available
  • Any timestamp within window
  • Minute-level granularity

How to use:

  1. Go to Backups
  2. Click Point-in-Time Recovery
  3. Select timestamp
  4. Confirm recovery

Result: New database created with data from that point

Restore from Backup#

Restore from a specific backup:

Available backups:

  • Daily backups
  • Weekly backups
  • Manual backups
  • Automatic backups

How to restore:

  1. Go to Backups
  2. Click Restore on backup
  3. Create new database or overwrite
  4. Confirm

Result: New database with backup data

Backup Export#

Download backup for external storage:

Formats:

  • SQL dump for MySQL/PostgreSQL
  • JSON for MongoDB
  • RDB dump for Redis

How to export:

  1. Go to Backups
  2. Click Export on backup
  3. Select format
  4. Download file

Use for:

  • Long-term archival
  • Off-site storage
  • Migration
  • Compliance requirements

Maintenance#

Regular Tasks#

Weekly:

  • Monitor metrics
  • Check disk usage
  • Review slow queries
  • Verify backups

Monthly:

  • Review performance trends
  • Optimize indexes
  • Archive old data
  • Update documentation

Quarterly:

  • Test recovery
  • Review scaling needs
  • Plan upgrades
  • Security audit

Database Optimization#

Index Optimization:

-- Find missing indexes (PostgreSQL)
SELECT * FROM pg_stat_user_tables
WHERE n_live_tup > 10000 AND idx_scan = 0;

Vacuum and Analyze:

-- PostgreSQL maintenance
VACUUM ANALYZE;
-- MySQL maintenance
OPTIMIZE TABLE table_name;

Archive Old Data:

  • Move old records to archive table
  • Delete unnecessary data
  • Rebuild indexes
  • Update statistics

Monitoring Logs#

View database activity:

Available logs:

  • Error logs
  • Slow query logs
  • Access logs
  • Audit logs

How to view:

  1. Go to Logs
  2. Filter by date/type
  3. Search for keywords
  4. Export for analysis

Troubleshooting#

Problem: High CPU Usage#

Symptoms:

  • CPU > 85%
  • Slow queries
  • Connection timeouts

Causes:

  • Heavy queries
  • Many concurrent connections
  • Missing indexes
  • Inefficient code

Solutions:

  1. Identify slow queries from logs
  2. Optimize problem queries
  3. Add missing indexes
  4. Implement caching
  5. Scale up if needed

Problem: High Memory Usage#

Symptoms:

  • Memory > 80%
  • Slow performance
  • Out of memory errors

Causes:

  • Large result sets
  • Inadequate indexes
  • Memory leaks
  • Large temporary tables

Solutions:

  1. Check for large queries
  2. Add indexes
  3. Optimize queries
  4. Increase batch size
  5. Scale memory

Problem: Disk Space Running Out#

Symptoms:

  • Disk > 90%
  • Write errors
  • Cannot insert data

Causes:

  • Accumulation of data
  • Large tables
  • Uncleared logs
  • Transaction logs

Solutions:

  1. Archive old data
  2. Delete unnecessary data
  3. Clear logs
  4. Increase storage immediately
  5. Implement data retention policy

Problem: Slow Queries#

Symptoms:

  • Queries taking > 1 second
  • Application slower
  • High CPU with few queries

Causes:

  • Missing indexes
  • Poor query design
  • Outdated statistics
  • Large tables

Solutions:

  1. Enable query logging
  2. Identify slow queries
  3. Add needed indexes
  4. Rewrite problematic queries
  5. Optimize schema

Best Practices#

1. Monitor Regularly#

  • Check metrics daily
  • Set up alerts
  • Review performance trends
  • Act on warnings early

2. Plan for Growth#

  • Monitor disk usage
  • Forecast data growth
  • Scale before hitting limits
  • Don't wait for emergency

3. Backup Regularly#

  • Verify backups work
  • Test restoration quarterly
  • Keep backups in multiple locations
  • Document recovery procedures

4. Optimize Performance#

  • Monitor slow queries
  • Add needed indexes
  • Archive old data
  • Update statistics

5. Keep Updated#

  • Apply security patches
  • Upgrade versions periodically
  • Follow upgrade schedule
  • Test before upgrading

6. Secure Access#

  • Restrict network access
  • Use SSL/TLS
  • Change default passwords
  • Monitor access logs

7. Document Changes#

  • Keep change log
  • Document schema changes
  • Note scaling events
  • Record optimization changes

Next Steps#

  1. Backup & Recovery - Deep dive into backups
  2. Database Best Practices - Optimization tips
  3. Troubleshooting - Common issues

Support#

Questions about management?