Open sunakan opened 19 hours ago
次はADMIN PREPARE
# Profile
# Rank Query ID Response time Calls R/Call V/M
# ==== =================================== ============= ====== ====== ===
# 1 0xDA556F9115773A1A99AA0165670CE848 57.7067 17.3% 169464 0.0003 0.01 ADMIN PREPARE
# 2 0xF1B8EF06D6CA63B24BFF433E06CCEB22 31.7198 9.5% 4175 0.0076 0.01 SELECT users livestreams livecomments
# 3 0xDB74D52D39A7090F224C4DEEAF3028C9 29.7237 8.9% 4180 0.0071 0.01 SELECT users livestreams reactions
ssh isu-1
vim webapp/go/main.go
func connectDB(logger echo.Logger) (*sqlx.DB, error) {
// ...
db, err := sqlx.Open("mysql", conf.FormatDSN())
// ...
return db, nil
}
から conf.FormatDSN() をちょっと見る
自作じゃなかった
func connectDB(logger echo.Logger) (*sqlx.DB, error) {
// ...
conf := mysql.NewConfig()
// ...
conf.Net = "tcp"
conf.Addr = net.JoinHostPort("127.0.0.1", "3306")
conf.User = "isucon"
conf.Passwd = "isucon"
conf.DBName = "isupipe"
conf.ParseTime = true
// ...
}
AIにきいてみた
user:password@tcp(localhost:3306)/testdb?parseTime=true&collation=utf8mb4_general_ci
例として↑のような文字列が返ってくるらしい
user:password@tcp(localhost:3306)/testdb?parseTime=true&collation=utf8mb4_general_ci&interpolateParams=true
みたいに interpolateParams=true
が付けば良い
conf.Net = "tcp"
conf.Addr = net.JoinHostPort("127.0.0.1", "3306")
conf.User = "isucon"
conf.Passwd = "isucon"
conf.DBName = "isupipe"
conf.ParseTime = true
+ conf.InterpolateParams = true
これで良さそう
make true-interpolate-params
make clean-log
して計測
スコア:6476
続き