cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

sql: allow monitoring and controlling long running queries

Open a6802739 opened this issue 10 years ago • 10 comments

Original question: will cocoroachdb have plans to support 'watching thread running state' like show processlist in mysql.

Users should be able to observe progress of long-running operations like online schema changes or large queries; and potentially interrupt operations asynchronously.

a6802739 avatar Jun 02 '16 08:06 a6802739

@a6802739 yes this is on the roadmap.

knz avatar Jun 04 '16 13:06 knz

@petermattis is there a way to link particular issues like this one to our roadmap, so we can update them when we get there?

knz avatar Jun 04 '16 13:06 knz

@knz Sure, edit the wiki and add a link to the issue. Someone recently did this for common table expressions.

petermattis avatar Jun 04 '16 14:06 petermattis

Tracking progress of schema changes and backup / restore operations is targeted for 1.0. We'll likely have a different mechanism for tracking long running queries.

petermattis avatar Feb 22 '17 15:02 petermattis

Retitling this to target long running queries. See #7554 for the system jobs table.

spencerkimball avatar Apr 01 '17 23:04 spencerkimball

@knz , @petermattis any suggestions to start with for this feature, we need this in our production urgently.

a6802739 avatar Apr 13 '17 06:04 a6802739

@a6802739 We need to sketch out a design first. In addition to being able to display running queries, we need to be able to cancel them too. Presumably we'd want to be able to show all of the SQL sessions (i.e. connections) and what queries are running on them.

petermattis avatar Apr 13 '17 12:04 petermattis

FWIW #10317 provides a mechanism to inspect currently open sessions on a node. I could complete the PR using the design direction suggested by Andrei (and Ben) in there. The missing piece would be cancellation, but perhaps context cancellation would help us here.

knz avatar Apr 13 '17 12:04 knz

For SHOW PROCESSLIST (or whatever we call it) we'd want to be able to show the sessions across the entire cluster. Some sort of fan out query to retrieve the sessions per node.

petermattis avatar Apr 13 '17 12:04 petermattis

Both SHOW QUERIES and CANCEL QUERY is in master. See PRs: https://github.com/cockroachdb/cockroach/pull/16072 https://github.com/cockroachdb/cockroach/pull/17003 https://github.com/cockroachdb/cockroach/pull/17527

itsbilal avatar Aug 23 '17 15:08 itsbilal