Mark Wunsch
Mark Wunsch

Reputation: 139

BigQuery: View -vs- Table Query Speed

I am interested in using a view to limit access to only certain partitions of a table. Should I expect to see decreased performance when selecting from the view as opposed to selecting from the table directly (slower response times or higher data usage)? Does the data essentially have to be selected twice?

View Query:

SELECT 
     *

FROM 
     project:dataset.table 

WHERE 
     _PARTITIONTIME between DATE_ADD(CURRENT_TIMESTAMP(), -1, "MONTH") and CURRENT_TIMESTAMP()

Upvotes: 1

Views: 5239

Answers (1)

Elliott Brossard
Elliott Brossard

Reputation: 33705

It's the same performance characteristics either way. You can imagine that a reference to a view is equivalent to inlining the SQL text into the rest of the query.

Upvotes: 7

Related Questions