BigQuery Cost Optimization: Select Queries
Skills:
Data Literacy60%
Key Takeaways
Optimizes BigQuery costs for SELECT queries
Full Transcript
welcome back to our series about bigquery cost optimization where today we'll be focusing on how you can optimize your queries specifically your select queries for both cost and performance as a reminder bigquery is a fully separated storage and compute Data Warehouse in lake house which means that you only pay for the storage as you need it and you only pay for the compute as you're analyzing data the art of query optimization considers both how you can optimize using storage and compute to derive the best query performance and query costs as a result of different options you may take so what can you do to actually optimize your different select query performance first let's think about how you can optimize different parts of a query because we'll take different methods depending on the type of performance that we need to optimize for and cost optimize for first is the i o or think of this as things like the scans and the shuffles that happen in our data this refers to the amount of data that we pass around either at the first scan is a part of the scan or a subsequent steps as a part of the shuffle next we need to consider how our data is joined at specific stages and aggregated as a part of a stage or subsequent stations this is how we can change our groupings for how much how many bytes do we pass through and how much CPU work did this consume last is how we can actually take this and then change our materialization or how much data we output as a result of our queries by reducing this we can improve our query performance because there's less data to actually write out to both storage and to a result pan so let's start optimizing the first and most common optimization for end user queries is changing the default user Behavior so we don't run select star across the table because bigquery storage is columnar It is Well optimized for running Aggregates but not returning large amounts of data across rows arbitrarily it's a good idea when running a query to only select the columns that you need or use select start accept which is a unique feature in bigquery to exclude the columns which you know you don't need this improves performance by reducing the number of bytes scanned at the outside and then also reduces the bytes that are past the subsequent stages this principle of scan reduction also applies to filter statements or where Clauses in your queries generally the sooner you can filter data the better and the more you can filter at the start the less data will be required at the end next let's look at how table designs can impact our query costs and performance we just discovered covered how we can use common performance optimization by reducing the bytes scanned as a part of our query syntax partitioning in clustering tables that are used by Common attributes is another way to help continue to reduce the byte scanned and sometimes improve performance of other things like joins you can use the recommender here which runs in our background of bigquery to propose table design options based on the queries that you run to help both improve performance and the resulting costs of both the table and your query reducing compute work is important to improving the cost and performance of bigquery one of the most common drivers of high compute is the use of functions like order by or rank where data must be sorted before it is outputted it's best to do these at the very end of a query as these operations typically have to run on a small subset of data and it typically can get pegged to a small set of slots to actually do the work you can use limits also on these to help reduce the amount of data that actually is returned so once the limit is reached the query can stop Computing which improves the performance of the query and how many slots you use at the end last it's important to consider how skew may impact your data SKU can be a difficult concept at times to understand but essentially this is how are we getting things into equal components to run across a distributed system eliminating or reducing skew in your queries can sometimes mean changing data filters or redesigning how the data is loaded into tables and stored so it is evenly distributed which means that many slots can work in parallel in order to accomplish the common output of getting your query done as fast as possible and at the lowest costs we hope you found these tips and tricks useful for optimizing your query costs and performance querying
Original Description
Highlights ways for developers and administrators to improve cost and performance of SELECT queries in BigQuery.
Subscribe to Google Cloud Tech → https://goo.gle/GoogleCloudTech
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Google Cloud Tech · Google Cloud Tech · 16 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
▶
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
I’m going for it #GoogleCloudCertified
Google Cloud Tech
I had to get #GoogleCloudCertified
Google Cloud Tech
Be better overall at what you do #GoogleCloudCertified
Google Cloud Tech
Cloud Monitoring on our radar #Analysis #Uptime
Google Cloud Tech
Introduction to Generative AI Studio
Google Cloud Tech
How to use Github Actions with Google's Workload Identity Federation
Google Cloud Tech
Introduction to Responsible AI
Google Cloud Tech
Networking updates and CDMC-certified architecture
Google Cloud Tech
Create and use a Cloud Storage bucket
Google Cloud Tech
How to digitize text from documents
Google Cloud Tech
Faster analytical queries with AlloyDB
Google Cloud Tech
Next ‘23 sessions and FaaS Wave
Google Cloud Tech
Introduction to Assured Open Source Software
Google Cloud Tech
BigQuery Cost Optimization: Storage
Google Cloud Tech
BigQuery Cost Optimization: Compute
Google Cloud Tech
BigQuery Cost Optimization: Select Queries
Google Cloud Tech
Remote Field Equipment Management with Manufacturing Data Engine
Google Cloud Tech
Supercharging your applications with Cloud SQL Enterprise Plus
Google Cloud Tech
Vector Support on our radar #GenAI
Google Cloud Tech
Architecting a blockchain startup with Google Cloud
Google Cloud Tech
Kubernetes and multitasking updates!
Google Cloud Tech
GKE: Using Kubernetes Events
Google Cloud Tech
How to configure firewall rules for Cloud Composer
Google Cloud Tech
Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Google Cloud Tech
Geospatial analytics on our radar #EarthEngine #BigQuery
Google Cloud Tech
Ensuring requests are set in Kubernetes
Google Cloud Tech
Cloud Next 2023, Google research program, and more!
Google Cloud Tech
How to migrate projects between organizations with Resource Manager
Google Cloud Tech
How to run #MySQL in Google Cloud
Google Cloud Tech
#GenerativeAI for enterprises and #Next2023
Google Cloud Tech
How Google Photos scales to store 4 trillion photos and videos
Google Cloud Tech
Google Cross-Cloud Interconnect (Demo 2)
Google Cloud Tech
GKE Cost Optimization Golden Signals: Introduction
Google Cloud Tech
GKE Cost Optimization Golden Signals: Workload Rightsizing
Google Cloud Tech
GKE Load Balancing: Overview
Google Cloud Tech
GKE Load Balancing: Best Practices
Google Cloud Tech
Disaster Recovery in GKE
Google Cloud Tech
How to configure IP masquerade agent in GKE Standard clusters
Google Cloud Tech
Enable and use GKE Control plane logs
Google Cloud Tech
Compliance in Australia with Assured Workloads
Google Cloud Tech
Creating budgets and budget alerts in Google Cloud #FinOps
Google Cloud Tech
Cloud SQL Enterprise Plus on our radar #mySQL
Google Cloud Tech
What's Next for Google Cloud?
Google Cloud Tech
How Loveholidays scaled with Contact Center AI
Google Cloud Tech
What is fleet team management in GKE?
Google Cloud Tech
Troubleshoot VPC Network Peering
Google Cloud Tech
Introduction to DocAI and Contact Center AI
Google Cloud Tech
Cloud Run Direct VPC egress explained
Google Cloud Tech
Database deployment options in GKE
Google Cloud Tech
Analyze cloud billing data with #BigQuery
Google Cloud Tech
Tips to becoming a world-class Prompt Engineer
Google Cloud Tech
Serverless is simple. Do I need CI/CD?
Google Cloud Tech
Accelerating model deployment with MLOps
Google Cloud Tech
How Hawaii's Department of Human Services scaled with CCAI
Google Cloud Tech
Pricing API on our #Radar
Google Cloud Tech
How Recommendations AI for Media can boost customer retention
Google Cloud Tech
Troubleshooting: Node Not Ready Status
Google Cloud Tech
One weekend until Cloud Next 2023!
Google Cloud Tech
#GoogleCloudNext starts tomorrow!
Google Cloud Tech
#GoogleCloudNext will be demand!
Google Cloud Tech
More on: Data Literacy
View skill →Related Reads
📰
📰
📰
📰
South Korea will give all 52 million citizens free AI access, becoming the first G20 nation to do so
The Next Web AI
Learn AI Training from Industry Experts at Visualpath
Dev.to · kalyan visualpath
AI Theatre: The Gap Between Talking About AI and Actually Using It
Medium · Cybersecurity
How to Structure Content for AI-First Indexing: 7 Rules That Get You Cited
Medium · AI
🎓
Tutor Explanation
DeepCamp AI