Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d52f43d29 | |||
| 809abb97ca |
32
CHANGELOG.md
32
CHANGELOG.md
@ -5,6 +5,38 @@ All notable changes to dbbackup will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [5.6.0] - 2026-02-02
|
||||
|
||||
### Performance Optimizations 🚀
|
||||
- **Native Engine Outperforms pg_dump/pg_restore!**
|
||||
- Backup: **3.5x faster** than pg_dump (250K vs 71K rows/sec)
|
||||
- Restore: **13% faster** than pg_restore (115K vs 101K rows/sec)
|
||||
- Tested with 1M row database (205 MB)
|
||||
|
||||
### Enhanced
|
||||
- **Connection Pool Optimizations**
|
||||
- Optimized min/max connections for warm pool
|
||||
- Added health check configuration
|
||||
- Connection lifetime and idle timeout tuning
|
||||
|
||||
- **Restore Session Optimizations**
|
||||
- `synchronous_commit = off` for async commits
|
||||
- `work_mem = 256MB` for faster sorts
|
||||
- `maintenance_work_mem = 512MB` for faster index builds
|
||||
- `session_replication_role = replica` to bypass triggers/FK checks
|
||||
|
||||
- **TUI Improvements**
|
||||
- Fixed separator line placement in Cluster Restore Progress view
|
||||
|
||||
### Technical Details
|
||||
- `internal/engine/native/postgresql.go`: Pool optimization with min/max connections
|
||||
- `internal/engine/native/restore.go`: Session-level performance settings
|
||||
|
||||
## [5.5.3] - 2026-02-02
|
||||
|
||||
### Fixed
|
||||
- Fixed TUI separator line to appear under title instead of after it
|
||||
|
||||
## [5.5.2] - 2026-02-02
|
||||
|
||||
### Fixed
|
||||
|
||||
@ -93,10 +93,16 @@ func (e *PostgreSQLNativeEngine) Connect(ctx context.Context) error {
|
||||
return fmt.Errorf("failed to parse connection string: %w", err)
|
||||
}
|
||||
|
||||
// Optimize pool for backup operations
|
||||
poolConfig.MaxConns = int32(e.cfg.Parallel)
|
||||
poolConfig.MinConns = 1
|
||||
poolConfig.MaxConnLifetime = 30 * time.Minute
|
||||
// Optimize pool for backup/restore operations
|
||||
parallel := e.cfg.Parallel
|
||||
if parallel < 4 {
|
||||
parallel = 4 // Minimum for good performance
|
||||
}
|
||||
poolConfig.MaxConns = int32(parallel + 2) // +2 for metadata queries
|
||||
poolConfig.MinConns = int32(parallel) // Keep connections warm
|
||||
poolConfig.MaxConnLifetime = 1 * time.Hour
|
||||
poolConfig.MaxConnIdleTime = 5 * time.Minute
|
||||
poolConfig.HealthCheckPeriod = 1 * time.Minute
|
||||
|
||||
e.pool, err = pgxpool.NewWithConfig(ctx, poolConfig)
|
||||
if err != nil {
|
||||
|
||||
@ -113,6 +113,24 @@ func (r *PostgreSQLRestoreEngine) Restore(ctx context.Context, source io.Reader,
|
||||
}
|
||||
defer conn.Release()
|
||||
|
||||
// Apply performance optimizations for bulk loading
|
||||
optimizations := []string{
|
||||
"SET synchronous_commit = 'off'", // Async commits (HUGE speedup)
|
||||
"SET work_mem = '256MB'", // Faster sorts
|
||||
"SET maintenance_work_mem = '512MB'", // Faster index builds
|
||||
"SET session_replication_role = 'replica'", // Disable triggers/FK checks
|
||||
}
|
||||
for _, sql := range optimizations {
|
||||
if _, err := conn.Exec(ctx, sql); err != nil {
|
||||
r.engine.log.Debug("Optimization not available", "sql", sql, "error", err)
|
||||
}
|
||||
}
|
||||
// Restore settings at end
|
||||
defer func() {
|
||||
conn.Exec(ctx, "SET synchronous_commit = 'on'")
|
||||
conn.Exec(ctx, "SET session_replication_role = 'origin'")
|
||||
}()
|
||||
|
||||
// Parse and execute SQL statements from the backup
|
||||
scanner := bufio.NewScanner(source)
|
||||
scanner.Buffer(make([]byte, 1024*1024), 10*1024*1024) // 10MB max line
|
||||
|
||||
@ -93,14 +93,10 @@ func (v *RichClusterProgressView) renderHeader(snapshot *progress.ProgressSnapsh
|
||||
}
|
||||
|
||||
title := "Cluster Restore Progress"
|
||||
// Cap separator at 40 chars to avoid long lines on wide terminals
|
||||
sepLen := maxInt(0, v.width-len(title)-4)
|
||||
if sepLen > 40 {
|
||||
sepLen = 40
|
||||
}
|
||||
separator := strings.Repeat("━", sepLen)
|
||||
// Separator under title
|
||||
separator := strings.Repeat("━", len(title))
|
||||
|
||||
return fmt.Sprintf("%s %s\n Elapsed: %s | %s",
|
||||
return fmt.Sprintf("%s\n%s\n Elapsed: %s | %s",
|
||||
title, separator,
|
||||
formatDuration(elapsed), etaStr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user