Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: config DisableErrSkip #571

Merged
merged 1 commit into from
Jul 23, 2024
Merged

feat: config DisableErrSkip #571

merged 1 commit into from
Jul 23, 2024

Conversation

xhdnoah
Copy link

@xhdnoah xhdnoah commented Jul 23, 2024

带占位符的 SQL 执行流程为 prepared -> execute -> close 客户端将该语句和参数发给 mysql 编译成一个 prepared 语句,如果设置 interpolateparams=true 可以减少 prepared 请求,SQL 语句在客户端完成拼接。在 go-sql-driver/mysql 库中 如果发现没有设置该参数,会返回一个 ErrSkip 被 otelsql 捕捉,可以通过配置 DisableErrSkip 忽略这个报错,因为只是优化项不影响后续流程。但有实验表明 interpolateparams=true 能提高 QPS 18%,可以考虑在 DSN 中增加该参数
https://github.com/go-sql-driver/mysql/blob/f6a18cf1ac3e6bc282f72874a3742469a99e5762/connection.go#L327

@nicholasxuu nicholasxuu merged commit 1e8217c into shanbay:master Jul 23, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants