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

Establishing a connection to the database is taking around 2.5 seconds #207

Open
Dviswanath560 opened this issue Aug 11, 2023 · 0 comments

Comments

@Dviswanath560
Copy link

Connecting to the postgres is taking almost 2.5 seconds. Is there any way that can be reduced:

import (
"fmt"
"time"

"gorm.io/driver/postgres"
"gorm.io/gorm"

)

func main() {
fmt.Println("starting")
startTime := time.Now()
dsn := "host=127.0.0.1 user=xxxx password=xxxx dbname=xxxxx port=xxxx sslmode=disable"
_, err := gorm.Open(postgres.Open(dsn), &gorm.Config{
DisableAutomaticPing: true,
})
fmt.Printf("Total time taken: %v ", time.Since(startTime))
}

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

1 participant