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

Speed up MySQL inserts during prepare #419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/lua/oltp_common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ function prepare_commit()
end

function prepare_for_each_table(key)
if drv:name() == "mysql"
then
con:query("SET autocommit=0, unique_checks=0, foreign_key_checks=0")
end
for t = 1, sysbench.opt.tables do
stmt[t][key] = con:prepare(string.format(stmt_defs[key][1], t))

Expand Down Expand Up @@ -316,6 +320,10 @@ function prepare_for_each_table(key)
stmt[t][key]:bind_param(unpack(param[t][key]))
end
end
if drv:name() == "mysql"
then
con:query("SET autocommit=1, unique_checks=1, foreign_key_checks=1")
end
end

function prepare_point_selects()
Expand Down