| name | analyze-incremental-backup-efficiency |
| description | Use SHOW BACKUP to analyze incremental backup efficiency by comparing data_size, row_count, and performance metrics across backup chains. Calculate storage savings, monitor change rates, and optimize backup frequency based on data patterns. Essential for balancing RPO requirements with storage costs. |
| metadata | {"domain":"Backup and Restore","bloom_level":"Analyze","version":"1.1.0","cockroachdb_version":"v26.1.0+","status":"complete"} |
Analyze Incremental Backup Efficiency
Domain: Backup and Restore
Bloom's Level: Analyze
CockroachDB Version: v26.1.0+
What This Skill Teaches
This skill teaches you how to analyze incremental backup efficiency using SHOW BACKUP metrics. You'll learn to calculate storage savings, understand data change patterns, and optimize backup strategies based on actual workload characteristics.
When to use this skill:
- Evaluating backup strategy effectiveness
- Optimizing storage costs while meeting RPO requirements
- Understanding data change patterns and growth trends
- Capacity planning for backup storage infrastructure
- Troubleshooting backup performance degradation
Key metrics analyzed:
data_size: Bytes stored in each backup layer
row_count: Number of rows in each backup
start_time / end_time: Backup duration
- Storage savings percentage (incremental vs full)
- Change rate (rows/data modified between backups)
Instructions
Understanding Incremental Backup Metrics
SHOW BACKUP provides key metrics for efficiency analysis:
SHOW BACKUP FROM LATEST IN 'gs://acme-backups/production';
Metric Definitions:
- data_size: Compressed size of data in this backup layer (bytes)
- rows: Number of rows included in this backup layer
- start_time / end_time: Backup duration window
Important Notes:
- Incremental backups only include changed data since last backup
- Full backups include all data regardless of changes
- Row count in incrementals = new + modified + deleted rows
Calculating Storage Savings
Compare full vs incremental backup sizes:
SHOW BACKUPS IN 'gs://acme-backups/production';
SHOW BACKUP '2026-03-01-full' IN 'gs://acme-backups/production';
SHOW BACKUP '2026-03-01-full/2026-03-02T00:00:00Z' IN 'gs://acme-backups/production';
Analyzing Data Change Rates
Understand how much data changes between backups:
SHOW BACKUP '2026-03-01-full' IN 'gs://acme-backups/production';
SHOW BACKUP '2026-03-01-full/2026-03-02T00:00:00Z' IN 'gs://acme-backups/production';
Evaluating Backup Performance Trends
Monitor backup performance over time:
Optimizing Backup Frequency
Determine optimal backup schedule based on change rates:
Common Patterns
Pattern 1: Monthly Backup Efficiency Report
Generate comprehensive backup efficiency analysis:
WITH backup_metrics AS (
SELECT
'2026-03-01' AS backup_date,
'full' AS backup_type,
10000000000 AS data_size_bytes,
5000000 AS row_count
UNION ALL SELECT '2026-03-02', 'incremental', 500000000, 250000
UNION ALL SELECT '2026-03-03', 'incremental', 525000000, 262500
)
SELECT
backup_date,
backup_type,
ROUND(data_size_bytes / 1024.0 / 1024.0 / 1024.0, 2) AS size_gb,
row_count,
CASE
WHEN backup_type = 'full' THEN 100
ELSE ROUND(100.0 * data_size_bytes /
LAG(data_size_bytes) FILTER (WHERE backup_type = 'full') OVER (ORDER BY backup_date), 2)
END AS pct_of_full
FROM backup_metrics
ORDER BY backup_date;
Pattern 2: Cost-Benefit Analysis for Backup Strategy
Compare storage costs across different backup strategies:
Pattern 3: Anomaly Detection in Backup Patterns
Identify unusual data changes:
WITH incremental_sizes AS (
SELECT
backup_date,
data_size_gb,
AVG(data_size_gb) OVER (
ORDER BY backup_date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW
) AS rolling_avg_7day
FROM (
VALUES
('2026-02-24', 0.48), ('2026-02-25', 0.49),
('2026-02-26', 0.47), ('2026-03-03', 2.85)
) AS daily_backups(backup_date, data_size_gb)
)
SELECT
backup_date,
ROUND(data_size_gb, 2) AS size_gb,
ROUND(rolling_avg_7day, 2) AS avg_7day_gb,
CASE
WHEN data_size_gb > rolling_avg_7day * 2
THEN 'ANOMALY: Backup size significantly above normal'
ELSE 'Normal'
END AS status
FROM incremental_sizes
ORDER BY backup_date DESC;
SHOW BACKUP '2026-03-01-full/2026-03-03T00:00:00Z' IN 'gs://acme-backups/production';
Pattern 4: Backup Strategy Optimization Workflow
#!/bin/bash
echo "=== Backup Efficiency Analysis ==="
echo "Current strategy: Weekly full + daily incremental"
echo "30-day storage: 56 TB"
echo "Monthly cost: \$1,319"
echo ""
echo "Alternative strategies:"
echo " A. Daily full: 315 TB, \$7,418/month"
echo " B. Weekly full + daily incr: 56 TB, \$1,319/month (CURRENT)"
echo " C. Bi-weekly full + daily incr: 38 TB, \$896/month"
echo ""
echo "Recommendation: Keep current strategy (B)"
echo " - Optimal balance of cost and recovery time"
echo " - Consider C if budget constraints require further reduction"
Troubleshooting
Issue 1: Incremental Backups Growing Larger Than Expected
Symptoms:
- Incremental backups approaching full backup size
- Storage savings not meeting expectations
Diagnosis:
SHOW BACKUP '2026-03-01-full' IN 'gs://acme-backups/production';
SHOW BACKUP '2026-03-01-full/2026-03-07T00:00:00Z' IN 'gs://acme-backups/production';
Solutions:
ALTER TABLE sessions SET (ttl_expire_after = '24 hours');
BACKUP TABLE sessions INTO 'gs://acme-backups/sessions-daily/' WITH revision_history;
BACKUP DATABASE production INTO 'gs://acme-backups/production/'
WITH revision_history EXCEPT (production.sessions);
Issue 2: Backup Performance Degradation Over Time
Symptoms:
- Backup duration increasing over time
- Throughput (MB/s) decreasing
Diagnosis:
Solutions:
CREATE SCHEDULE production_backup FOR BACKUP DATABASE production
INTO 'gs://acme-backups/production/' RECURRING '@daily'
WITH revision_history, SCHEDULE OPTIONS first_run = '2026-03-07 02:00:00';
BACKUP DATABASE production INTO 'gs://acme-backups/production/{DATE_FORMAT}/';
Best Practices
-
Establish Baseline Metrics
- Document initial backup sizes and performance
- Track weekly/monthly trends for comparison
- Set thresholds for anomaly detection
-
Balance Cost vs Recovery Requirements
- Calculate actual storage costs for different strategies
- Test restore times for various chain lengths
- Re-evaluate as business needs change
-
Monitor Key Efficiency Indicators
- Storage savings percentage
- Daily change rate
- Backup throughput trends
- Anomalies (size spikes or drops)
-
Optimize Based on Table Characteristics
- High-churn tables: Separate backup strategy
- Stable tables: Longer intervals between full backups
- Ephemeral tables: Evaluate if backups needed
-
Automate Analysis and Reporting
- Script monthly efficiency reports
- Alert on anomalies (size spikes >2× average)
- Dashboard for backup cost tracking
-
Regular Strategy Reviews
- Monthly: Review backup costs and storage trends
- Quarterly: Analyze efficiency and optimize schedule
- Annually: Test disaster recovery procedures
Related Skills
- verify-backup-file-integrity-with-checkfiles: Validate backup completeness
- understand-incremental-backup-concepts: Backup chain architecture
- create-incremental-backups-with-backup-into-latest: Create efficient backup chains
- manage-backup-retention-policies: Optimize retention based on efficiency analysis
- inspect-backup-contents-with-show-backup: Extract detailed backup metadata
- create-automated-backup-schedules: Implement optimized backup frequencies