Commit 48d77ea2 by Carl Bergquist Committed by GitHub

Merge pull request #9785 from certusoft/mysql_performance

MySQL Performance when using GF_DATABASE_URL
parents 56fe1308 a51b1e89
......@@ -82,6 +82,9 @@ max_idle_conn = 2
# Max conn setting default is 0 (mean not set)
max_open_conn =
# Set to true to log the sql calls and execution times.
log_queries =
# For "postgres", use either "disable", "require" or "verify-full"
# For "mysql", use either "true", "false", or "skip-verify".
ssl_mode = disable
......
......@@ -91,6 +91,8 @@
# Max conn setting default is 0 (mean not set)
;max_open_conn =
# Set to true to log the sql calls and execution times.
log_queries =
#################################### Session ####################################
[session]
......
......@@ -224,6 +224,9 @@ The maximum number of connections in the idle connection pool.
### max_open_conn
The maximum number of open connections to the database.
### log_queries
Set to `true` to log the sql calls and execution times.
<hr />
## [security]
......
......@@ -158,10 +158,14 @@ func getEngine() (*xorm.Engine, error) {
} else {
engine.SetMaxOpenConns(DbCfg.MaxOpenConn)
engine.SetMaxIdleConns(DbCfg.MaxIdleConn)
debugSql := setting.Cfg.Section("database").Key("log_queries").MustBool(false)
if !debugSql {
engine.SetLogger(&xorm.DiscardLogger{})
// engine.SetLogger(NewXormLogger(log.LvlInfo, log.New("sqlstore.xorm")))
// engine.ShowSQL = true
// engine.ShowInfo = true
} else {
engine.SetLogger(NewXormLogger(log.LvlInfo, log.New("sqlstore.xorm")))
engine.ShowSQL(true)
engine.ShowExecTime(true)
}
}
return engine, nil
}
......@@ -190,12 +194,12 @@ func LoadConfig() {
DbCfg.Host = sec.Key("host").String()
DbCfg.Name = sec.Key("name").String()
DbCfg.User = sec.Key("user").String()
DbCfg.MaxOpenConn = sec.Key("max_open_conn").MustInt(0)
DbCfg.MaxIdleConn = sec.Key("max_idle_conn").MustInt(0)
if len(DbCfg.Pwd) == 0 {
DbCfg.Pwd = sec.Key("password").String()
}
}
DbCfg.MaxOpenConn = sec.Key("max_open_conn").MustInt(0)
DbCfg.MaxIdleConn = sec.Key("max_idle_conn").MustInt(0)
if DbCfg.Type == "sqlite3" {
UseSQLite3 = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment