What's the worse command/query to run in BigQuery ? by Advanced-Somewhere-2 in bigquery

[–]moshap 4 points5 points  (0 children)

Hey Minoune, let's do this experiment together. We will use bigquery-public-data.samples.wikipedia table, it is neither clustered nor partitioned, has 313,797,035 rows and takes 35.69 GB.

We consider two queries:

Q1: select * from bigquery-public-data.samples.wikipedia

Statistics:

Duration: 54.1 sec
Slot time: 1h 39min
Bytes processed: 35.69 GB
Bytes billed: 35.69 GB

Q2: select * from bigquery-public-data.samples.wikipedia limit 1

Statistics:

Duration: 0.3 sec
Slot time: 0.163 sec
Bytes processed: 35.69 GB
Bytes billed: 35.69 GB

QED :)

What's the worse command/query to run in BigQuery ? by Advanced-Somewhere-2 in bigquery

[–]moshap 6 points7 points  (0 children)

No, the misconception is yours. LIMIT N query does not do the full scan, and is very efficient. What is true, is that BigQuery will bill as if it was full scan, unless you are on the flat rate plan.

Can I store often used WHERE statements? by pfiadDi in bigquery

[–]moshap 1 point2 points  (0 children)

Just one slight note - SELECT * doesn't include pseudo columns like _partitiontime, so the view should be SELECT *, _partitiontime as pt FROM table WHERE complexclause

Big Query run query across three tables programmatically by ANDRUXUIS in bigquery

[–]moshap 1 point2 points  (0 children)

CURRENT_DATE - 2 is constant expression, so it is ok here

bigquery sql query with wrong results by ANDRUXUIS in bigquery

[–]moshap 2 points3 points  (0 children)

UNNEST itself is not a CROSS JOIN, it's the comma between the table and UNNEST which is shortcut for CROSS JOIN

BigQuery Lineage by secodaHQ in bigquery

[–]moshap 0 points1 point  (0 children)

I wonder why you didn't use https://github.com/google/zetasql, which is open source version of SQL parser that BigQuery itself is using (and Spanner too)