Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to stop running bigquery query

is there any way how to cancel a running query?

i use the web interface. first i ran a series of tests on tables of 10k and than 20k rows and the response was in seconds. but than i ran the triple join query on a table of 100k rows and it seems endless after thousand of seconds.

i just wanted to run some tests before moving all the work to bigquery but now i'm afraid it's gonna spend the whole monthly 100gb free limit + more.

the table is a simple key-value pairs of integer values.

like image 475
ulkas Avatar asked Mar 21 '13 16:03

ulkas


2 Answers

The shell command bq cancel job_id will do this now. You can get the job_id from the Query History tab in the BigQuery console. If you started the query via the CLI, it will have logged the job_id to the standard output.

like image 138
smparkes Avatar answered Sep 30 '22 12:09

smparkes


There isn't a way, currently to stop a running query either via the API or the UI. You may be able to close the query builder (via the 'x' in the top right of the UI) and re-open it again to make the UI responsive again. We're currently working on this feature in the UI.

It is surprising that the query would take so long, even for a join, for tables of that size, unless your join was joining on non-unique keys so was taking time generating the cross-products of matching keys. For example:

SELECT t1.foo 
FROM (SELECT 1 as one, foo FROM table1) t1 
JOIN (SELECT 1 as one, bar FROM table2) t2
ON t1.one = t2.one

Would generate n x m rows where n is thenumber of rows in table1 and m is the number of rows in table2. Is there any chance your query is doing something similar? If not, can you send the query? (maybe in another SO question, related to slow join performance).

like image 39
Jordan Tigani Avatar answered Sep 30 '22 13:09

Jordan Tigani