It took over 18 minutes to run the following query with our test dataset:
SELECT count(distinct S1.visitorId, 50000) as returningVisitors,
STRFTIME_UTC_USEC(UTC_USEC_TO_DAY(PARSE_UTC_USEC(S1.timeStamp)), '%Y-%m-%d') AS day,
S1.dimension1, S1.dimension2
FROM [myDataset.MyTable] as S1
JOIN EACH [myDataset.MyTable] as S2 on S1.visitorId= S2.visitorId
WHERE UTC_USEC_TO_DAY(PARSE_UTC_USEC(S1.timeStamp)) < UTC_USEC_TO_DAY(NOW()) and
S2.timeStamp < STRFTIME_UTC_USEC(UTC_USEC_TO_DAY(PARSE_UTC_USEC(S1.timeStamp)), '%Y-%m-%d')
GROUP EACH BY S1.dimension1, S1.dimension2, day
ORDER BY S1.dimension1, S1.dimension2, day;
At the end I got the following message in the web browser: "Query complete (1112.1s elapsed, 1.62 MB processed)"
I wonder why it took so long. I usually have much faster results with BigQuery.
The query does a JOIN on the same table to get number of returning visitors for each day and dimensions. I expected the query to take maybe 5-6 minutes but not 18 minutes especially since the table is not that big.
My table as around 31000 rows and has a total size of 4.25 Mb. My job id is: job_b657aceeb1004994b0b0332d461cdcd2