user3853657
user3853657

Reputation: 239

Why did the query run so long in BigQuery

I run a query on the really small amount of intraday GA data (about 166 rows).

SELECT pagePath
FROM `dataset_id.ga_sessions_intraday_*`
WHERE pagePath NOT IN (SELECT pagePath FROM `dataset_id.ga_sessions_intraday_*` WHERE type = 'EVENT') AND Type = 'PAGE'

After running the query, there was a counter: "Query running (792.7s)..." that kept going up and up. By 3000 s, I accidentally refreshed the windows in the browser and now there is even no sign of the query that was running in Query History.

Why did it take so much time to run the query? Why is the query not available in the Query History?

Upvotes: 0

Views: 254

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172993

You used wildcard which means you were querying ALL ga_sessions_intraday_* tables in dataset_id dataset which potentially a reason of lengthy run

Another point of slowness is not optimal below WHERE clause

WHERE pagePath NOT IN (SELECT pagePath 
  FROM `dataset_id.ga_sessions_intraday_*` WHERE type = 'EVENT')  

you should rather use

WHERE pagePath NOT IN (SELECT pagePath 
  FROM `dataset_id.ga_sessions_intraday_*` WHERE type = 'EVENT' GROUP BY pagePath)

Upvotes: 1

Related Questions