willywonka15
willywonka15

Reputation: 97

Creating Biq Query View With Partitioning

I have a table in big query with 1 GB size. I create a view from this table with partitioning on created_at(timestamp) column. The view is useful for me but I want to write a query using created_at column. When I use this column , does the query run for whole data of view or run for only partitioned values? I want to limit usage of table like 500 MB. Is it possible with views by using partitioning column in where clause?

Upvotes: 0

Views: 1244

Answers (2)

db_gg
db_gg

Reputation: 129

You can create new partitioned tables (here is the documentation) and copy the data into them.

To query a partitioned table you can use _PARTITIONTIME, for example:

SELECT
  [COLUMN]
FROM
  [DATASET].[TABLE]
WHERE
  _PARTITIONTIME BETWEEN TIMESTAMP('2017-01-01') AND TIMESTAMP('2017-03-01')

Upvotes: 1

Daria
Daria

Reputation: 606

Unless you're using actual BigQuery partitioned tables (there is no such thing as partitioned views) you'll be charged for all the data in the columns you access.

Upvotes: 0

Related Questions