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

Postgres provider creating new connection for every state check related to database, schema, roles, grants etc.. #255

Open
mchhataniClearCover opened this issue Sep 29, 2022 · 3 comments

Comments

@mchhataniClearCover
Copy link

Hi there,

Thank you for opening an issue. Please provide the following information:

Terraform Version

Terraform v1.2.8 on darwin_amd64

Affected Resource(s)

Please list the resources as a list, for example:

  • postgresql_database
  • postgresql_extension
  • postgreql_role
  • postgresql_grant
  • postgres_schema
  • postgresql_default_privileges

Terraform Configuration Files

Debug Output

Panic Output

Expected Behavior

Use the same connection.

Actual Behavior

  1. We are using TF postgres provider to manager database, extension , schema, roles, grants , replication slot.
  2. We have implemented Atlantis to automatically plan the TF changes.
  3. For connecting to database, we use AWS VPC private Link + Network Load Balancer to talk to the database.
  4. When checking the postgres logs , it seems like for every status check with TF configuration and actual values in DB, a new connection is established, this leads to slowness sometimes when we use VPC link.

Steps to Reproduce

Important Factoids

References

@Anton-Shutik
Copy link

That might fix this issue as well. #289

@seanamos
Copy link

seanamos commented Oct 10, 2023

I spent some time looking at this because our postgres resources plan/apply relatively slowly compared to other providers/resources (especially our MSSQL resources). With a small amount of resources (<20), it's not that big of a problem, but when you get to >50, it really starts adding up in the plan/apply time.

I do believe the lack of connection re-use is one of the primary reasons it is quite slow.

@sdaberdaku
Copy link

Any news on this issue? With ~280 resources running terraform plan/apply is painfully slow.

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

4 participants