Faster results with Short query optimized mode in BigQuery

Val Deleplace
Google Cloud - Community
2 min readDec 18, 2024

Google Cloud BigQuery is best in class for querying petabytes of data in a handful of seconds. Of course, you can query small data as well, and get your results in 7or 8 seconds.

141 MB is not big data. It is a rookie number.

You may think 7 seconds to process 141 MB of indexed data is not very fast. This latency is in fact not proportional to the amount of data in your dataset. It mostly consists of the time it takes to create an asynchronous job, launch a distributed computation, and merge the results.

If, like me, you query small datasets more often than large datasets, you will appreciate the new Short query optimized mode (in preview). We’re not alone! I know a lot of people who actually use BigQuery for “small” queries.

Enable the Short query optimized mode in BigQuery Studio

This new mode skips the creation of an async job, for short queries.

I was curious to find out the real gains in response times! So I launched my favorite query many times in Standard mode and in Short query optimized mode.

When using the Short query optimized mode, the UI works a bit differently: no job info, no execution details. Also, the duration of the current query execution is not displayed. No big deal, I can still measure the duration using high-tech instruments.

Let’s find out the real latencies

Results

My query was taking on average 8.1s in standard mode, and is now taking on average 5.4s in the new mode. This is a noticeable 33% speed improvement.

Your mileage may vary, so don’t take my word for it. Try it interactively on your own dataset, in BigQuery Studio.

To leverage the optimized mode in your app, have a look at the code samples.

--

--

Google Cloud - Community
Google Cloud - Community

Published in Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Val Deleplace
Val Deleplace

Written by Val Deleplace

Engineer on cloudy things @Google. Opinions my own. Twitter @val_deleplace

No responses yet