Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Big Query table partition behavior with views

Hello All.

I have a bq table that is partitioned on one of the date columns. A view was created on top of this tables as (select * from table). 

If I use this view to query the table and filter on the partition column then what will happen

a. the query will scan the whole table based on the view definition?

b. bq will intelligently use the partition column filter in my query to select limited data?

Please share your thoughts on this.

~Ashish

Solved Solved
0 1 951
1 ACCEPTED SOLUTION

In BigQuery, when you create a view on top of a partitioned table and then query that view with a filter on the partition column, BigQuery should intelligently use the partitioning information to optimize your query. This means that BigQuery will only scan the relevant partitions based on your filter condition, rather than scanning the entire table.

BigQuery will intelligently use the partition column filter in your query to select limited data. This is one of the key benefits of using partitioned tables in BigQuery, as it can significantly improve query performance for date-based filtering and partition pruning.

View solution in original post

1 REPLY 1

In BigQuery, when you create a view on top of a partitioned table and then query that view with a filter on the partition column, BigQuery should intelligently use the partitioning information to optimize your query. This means that BigQuery will only scan the relevant partitions based on your filter condition, rather than scanning the entire table.

BigQuery will intelligently use the partition column filter in your query to select limited data. This is one of the key benefits of using partitioned tables in BigQuery, as it can significantly improve query performance for date-based filtering and partition pruning.