问题
I've got a relatively small dataset where I'm writing IP log analytics then doing queries against it.
I'm updating BigQuery once per hour with updated stats.
I have 110,000 rows with 37MB of data.
The below query takes anywhere from 7 seconds - 50+ seconds to run:
SELECT SUM(1) as views FROM [statistics.statsLogNSI] WHERE lastedit > DATE_ADD(CURRENT_TIMESTAMP(), -7, "DAY")
My more complex query examples are below:
SELECT SUM(1) as views FROM [statistics.statsLogNSI] WHERE NOT combination contains 'isRobot:True' AND ownerKey = '14013' AND country = 'US' AND lastedit > DATE_ADD(CURRENT_TIMESTAMP(), -7, "DAY")
Do you have a recommendation to optimize this result set? I saw a previous post about 'fragmentation' in BigQuery. Is updating the table once per hour too frequent?
来源:https://stackoverflow.com/questions/25130031/slow-bigquery-response