From the course: Data Warehousing on Google Cloud Platform

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Tips on running queries in BigQuery

Tips on running queries in BigQuery

- [Instructor] Here are some helpful hints when designing your tables and queries for optimal performance and cost reduction. BigQuery doesn't index primary keys, so make sure you use the appropriate data types for the expected data. For example, searching strings can be less efficient than doing an integer search. Avoid using SELECT * and select only the columns needed for the result set to reduce the amount of data read by the query. Limit the result set when possible. Filter data by using where clauses as early as possible to eliminate unwanted rows. Also, reduce the amount of data processed before joins by using common table expressions or subqueries to aggregate data before doing joins. Optimize your queries by making your largest table the one with the most rows, the main or left table, and then joining your smaller tables to that one. If you frequently use the same subqueries or views, consider creating new temporary tables to reduce the amount of reprocessing required every…

Contents