google-code-export / google-bigquery

Automatically exported from code.google.com/p/google-bigquery
1 stars 0 forks source link

Use cached result for views in composite queries that are based on those views. #184

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I ran small experiment and find out that composite queries do not use cached 
data for view that are used in request.

Testcase I used:
1. Ran query A that has same subquery repeated 6 times. Time to execute - 195sec
2. Ran subquery first time - Time to execute ~ 30sec
3. Ran subquery second time - Time to execute ~ 2.5sec
4. Created view based on subquery and request data - Time to execute ~ 30sec
5. Ran view request second time - Time to execute ~ 2.5sec
6. Ran initial query with subqueries replaced with view query - Time to execute 
~ 160sec

All data were static and was not updated during test.

It seems that there is no optimization of query execution plan based view, 
which could potentially save a lot of time, CPU and reads. Is it possible to 
include such kind of optimization in query planner?

Sincerely yours,
Kirill Lebedev
Chief Software engineer at Organizer

Original issue reported on code.google.com by kir...@organizer.com on 6 Nov 2014 at 11:01

GoogleCodeExporter commented 9 years ago
Funny, I had just been thinking about trying this.  It's not currently 
scheduled for work, but I'll update when/if we get there.

Original comment by e...@google.com on 18 Nov 2014 at 8:28