Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip postgres restart on first run #1232

Open
arvenil opened this issue Apr 26, 2024 · 1 comment
Open

Skip postgres restart on first run #1232

arvenil opened this issue Apr 26, 2024 · 1 comment

Comments

@arvenil
Copy link

arvenil commented Apr 26, 2024

Hi, we are using docker images with testcontainers. Each time new container is created, the db is initialized, migration scripts are applied and postgres server is restarted, adding around 25-50% startup time of whole container. This multiplied by hundred containers adds unnecessarily few hundred seconds. I've conducted some tests with pre-initialized database and the startup time significantly dropped, but that's really tricky to be done.

Any chance we could get a optimization setting for tests, to skip this server restart?

@tianon
Copy link
Member

tianon commented Apr 26, 2024

See #929 (comment) for somewhere I was answering something else recently, but I think my explanation there is probably helpful for explaining why what you're asking for isn't something we can reasonably accomplish with stock PostgreSQL, specifically:

We can't run SQL commands against PostgreSQL (generally) unless it is running and we have an appropriate method of access, and we can't start up PostgreSQL as the container's "PID 1" and still run more code reliably (nor can we start it and then "graduate" that instance to be PID 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants