go-gorm / go-gorm/postgres

Establishing a connection to the database is taking around 2.5 seconds

Open
#207 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
297
Forks
155
Avg merge
27m
Merged PRs (30d)
2

Description

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))
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.