How often should we open and close a db? On each request? Or each time a server comes up and goes down?

Sorry if this is the wrong place to post.

I’m wondering how often we should call

db, err := badger.Open(badger.DefaultOptions("/path/to/db"))
and
db.Close()

Is it something we should do once when the application starts up and then close when it goes down, or should we open and close with each request (in a web server context) or before and after each transaction?

What version of Go are you using (go version)?

1.18

$ go version

What operating system are you using?

Ubuntu 22.04

What version of Badger are you using?

v3

Does this issue reproduce with the latest master?

Steps to Reproduce the issue

What Badger options were set?

What did you do?

What did you expect to see?

What did you see instead?