In this article, you’ll see how to execute multiple queries in Google BigQuery — in parallel!
You’ll also learn about other solutions, like Query Tabs, that will help you improve your BigQuery productivity.
Let’s first jump into the core issue that is being addressed.
More Queries, More Problems
Whether you’re using BigQuery to explore a dataset or work on a company project, more often than not, you are working on more than one query at a time.
However, you lose old results after writing a new query — and re-running the previous query is time-consuming.
The quick fix? Open multiple Chrome tabs running BigQuery, with each tab containing a different query.
For some, switching across queries in separate Chrome Tabs (holy RAM usage, Batman!) is manageable. For others, it can be annoying to find that specific query amongst a sea of indistinguishable tabs. You’d have an easier time finding Waldo.
Solution #1: Query Tabs for BigQuery
In preparation for building the first iteration of superQuery’s IDE, we spoke with over 2,000 BigQuery users to learn how we could help them get the most out of BigQuery.
During those conversations, this tab issue was brought up a lot. Out of this, Multi-Tab Support for BigQuery was born. You could now separate queries into tabs .
Each tab even had its own results grid — no more re-running queries!
Solution #2: Multiple Queries — One BigQuery Tab
Building on this, users wanted us to go further — especially those with backgrounds in SQL Server Management Studio or Teradata.
They wanted to be able to execute multiple queries in a single BigQuery tab, and view each query’s results separately. This was actually our most popular feature request over the last five months!
For instance, if you’re exploring a dataset you might want to quickly see the progression of your results as you go along. Now that’s possible.
Simply write out your queries, separated by semicolons, and watch the results spit out faster than you can say “SELECT 1; SELECT 2; SELECT 3;“.
Here’s how it works:
In addition to running queries in parallel, superQuery also supports running queries in a sequence — commonly known as scripts.
This means you can set up queries to build off the results of the preceding query, as shown below.