Skip to content

🚀 v1.0.0: Lightning-Fast PostgreSQL Test Databases Go Stable!

Latest

Choose a tag to compare

@andrei-polukhin andrei-polukhin released this 23 Sep 07:55
· 10 commits to main since this release
73414ac

pgdbtemplate v1.0.0 - First Stable Release

We're thrilled to announce the first stable release of pgdbtemplate, a high-performance Go library that revolutionizes PostgreSQL testing by leveraging template databases for lightning-fast test execution.

🎯 What is pgdbtemplate?

pgdbtemplate provides a production-ready solution for creating isolated PostgreSQL test databases using PostgreSQL's native template database functionality. Instead of running expensive migrations for each test, it creates databases from a pre-migrated template, delivering significant performance improvements.

✨ Key Highlights

🚀 Performance That Scales

  • 1.2-1.6x faster than traditional database creation approaches
  • Consistent performance regardless of schema complexity
  • 17% less memory usage per operation
  • Thread-safe concurrent test database management
  • Scales to 500+ databases with ease

🔧 Production-Ready Features

  • Multiple driver support: Works with both pgx/v5 and database/sql + lib/pq
  • Testcontainers integration for containerized testing environments
  • Flexible migration runners with automatic file ordering
  • Connection string validation and PostgreSQL-specific optimizations
  • Comprehensive cleanup with automatic resource management

🛡️ Stability & Reliability

  • Fully thread-safe with mutex-protected operations
  • Unique database naming with collision-free generation
  • Proper resource cleanup prevents connection leaks
  • Extensive test coverage with real-world scenarios
  • Go 1.20+ compatibility

📊 Real-World Performance

Based on benchmarks with Apple M4 Pro:

Schema Complexity Traditional pgdbtemplate Performance Gain
1 Table ~28.9ms ~28.2ms 1.03x faster
3 Tables ~39.5ms ~27.6ms 1.43x faster
5 Tables ~43.1ms ~28.8ms 1.50x faster

Scaling Benefits:

  • 20 databases: 32% faster (906.8ms → 613.8ms)
  • 500 databases: 34% faster (22.31s → 14.82s)

🚀 Getting Started

Install with: go get github.com/andrei-polukhin/pgdbtemplate

Choose your PostgreSQL driver:

  • pgdbtemplate-pgx - For pgx/v5 with native connection pooling
  • pgdbtemplate-pq - For database/sql with lib/pq

See the README.md for comprehensive usage examples and quick start guides.

🔄 Migration Guide

From Development Versions

If you've been using development versions (pre-v1.0.0), the API is now stable and ready for production use. The core interfaces and functionality remain the same, with improvements to:

  • Error handling and resource cleanup
  • Documentation and examples
  • Performance optimizations
  • Thread safety guarantees

Breaking Changes

None. This is the first stable release establishing the baseline API.

📚 Documentation & Examples

  • README.md: Comprehensive usage examples and best practices
  • docs/ADVANCED.md: Custom providers and migration runners
  • docs/COMPARISON.md: Detailed comparison with other solutions
  • docs/BENCHMARKS.md: Performance methodology and results

🙏 Acknowledgments

Special thanks to:

  • The PostgreSQL community for template database functionality
  • Contributors who helped shape the API and functionality
  • Early adopters who provided valuable feedback

📦 What's Included

  • Core library with template database management
  • Two driver implementations (pgx and pq)
  • Comprehensive test suite with 95%+ coverage
  • Extensive documentation and examples
  • Docker-based testing infrastructure

Ready to supercharge your PostgreSQL testing? Get started with go get github.com/andrei-polukhin/pgdbtemplate and experience the future of fast, reliable database testing!

For questions, issues, or contributions, visit github.com/andrei-polukhin/pgdbtemplate.