diff --git a/docs/guides/using-go-and-pgx.rst b/docs/guides/using-go-and-pgx.rst index 636434d3af..68e2242926 100644 --- a/docs/guides/using-go-and-pgx.rst +++ b/docs/guides/using-go-and-pgx.rst @@ -109,3 +109,25 @@ pgx types directly. fmt.Println(author.Name) } + +.. note:: + For production applications, consider using pgxpool for connection pooling: + + .. code-block:: go + + import ( + "github.com/jackc/pgx/v5/pgxpool" + "example.com/sqlc-tutorial/db" + ) + + func main() { + pool, err := pgxpool.New(context.Background(), os.Getenv("DATABASE_URL")) + if err != nil { + fmt.Fprintf(os.Stderr, "Unable to create connection pool: %v\n", err) + os.Exit(1) + } + defer pool.Close() + + q := db.New(pool) + // Use q the same way as with single connections + }