-
Notifications
You must be signed in to change notification settings - Fork 0
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
MySQL KILL QUERY support #7
Comments
https://github.com/rocketlaunchr/mysql-go is an example of an implementation making use of |
# @param conn [Mysql2::Client] The connection to run the query on.
# @param killconn [Mysql2::Client] The connection to use to kill the query.
# @param sql [String] The SQL query string to execute.
# @param timeout [Numeric] The timeout (in seconds) to wait.
def query(conn, killconn, sql, timeout)
conn.query(sql, {async: true})
unless IO.select([IO.for_fd(conn.socket)], nil, nil, timeout)
killconn.query("KILL QUERY #{conn.thread_id}")
end
conn.async_result
end Something like this might work... A bit annoying that it requires a separate connection only for killing. |
Something a bit annoying: https://vitess.io/docs/reference/compatibility/mysql-compatibility/#killing-running-queries Although seems that vitess does have some magic comments? As a replacement for |
The current support for MySQL is fairly limited to only
SELECT
statements viaMAX_EXECUTION_TIME
.MySQL supports cancellation of queries via
KILL QUERY
which seems analogous to PostgreSQL's query cancellation.There are some awkward things though, MySQL doesn't rollback anything after a KILL which can mean that cancellation during UPDATE/DELETE/INSERT can be partial... This might be a no-go of an approach 🤷♂️ Needs to be dug into.
From Docs:
The text was updated successfully, but these errors were encountered: