Evaluating stored query results
Evaluating stored query results including generating a database query using a state specification of a graphical user interface, wherein the database query is composed to retrieve a current query result from a cloud-based data warehouse; searching a cache local to the query execution engine for the current query result, wherein the cache comprises a first previous query result from the cloud-based data warehouse; determining, based on the searching, that the current query result may be generated using the first previous query result from the cache; and creating the current query result using at least a portion of the first previous query result from the cache.
1 . A method for evaluating stored query results, the method comprising:
generating, by a query execution engine distributed between a client computing system and an intermediary computing system, a database query based on a state specification of a graphical user interface, wherein the database query is composed to retrieve a current query result from a cloud-based data warehouse;
searching, by the query execution engine, a cache local to the query execution engine for the current query result, wherein the cache comprises one or more previous query results from the cloud-based data warehouse;
comparing, by the query execution engine during execution of the database query and based on the searching, a computational expense of extracting at least a portion of the current query result from a first query result of the one or more previous query results with a computational expense of extracting the at least the portion of the current query result from at least one other query result of the one or more previous query results;
selecting, by the query execution engine, the first query result in response to the computational expense associated with the first query result being lower than the computational expense associated with the at least one other query result; and
creating, by the query execution engine, the current query result to include the portion of the first query result.
2 . The method of claim 1 , wherein:
the cache further comprises a second query result of the one or more previous query results from the cloud-based data warehouse;
determining, by the query execution engine based on the searching, that the current query result may be generated to include the portion extracted from the first query result comprises determining that the current query result may be generated as a combination of the first query result and the second query result from the cache; and
creating, by the query execution engine, the current query result comprises creating the current query result to include the portion of the first query result and at least the portion of the second query result from the cache.
3 . The method of claim 1 , further comprising providing, by the query execution engine, the current query result via the graphical user interface.
4 . The method of claim 1 , wherein generating, by the query execution engine, the database query comprises limiting the database query based on the portion of the current query result viewable via the graphical user interface.
5 . The method of claim 1 , further comprising determining that the current query result is generated to include a portion extracted from the first query result including determining that a value in the current query result may be calculated based on the first query result.
6 . The method of claim 1 , further comprising determining that the current query result is generated to include a portion extracted from the first query result including determining that the first query result is sufficient to calculate an extreme value for a column.
7 . The method of claim 1 , wherein the comparing further comprises dynamically estimating, during execution of the database query, resource utilization for each of the one or more previous query results based on current workload conditions of the query execution engine, wherein the computational expense is based on:
an estimated latency of retrieving the portion from each of the one or more previous query results,
an amount of data to be transferred between the client computing system and the intermediary computing system, and
a number of database operations predicted to be executed by the query execution engine.
8 . The method of claim 1 , wherein the cache is indexed based on database queries keyed to query results.
9 . The method of claim 1 , wherein the database query is a structured query language statement.
10 . The method of claim 1 , wherein the database query is generated by:
converting the state specification to an abstract syntax tree;
converting the abstract syntax tree to relational algebra; and
generating the database query from the relational algebra.
11 . An apparatus for evaluating stored query results, the apparatus comprising a computer processor and a computer memory operatively coupled to the computer processor, the computer memory comprising computer program instructions that, when executed by the computer processor, cause the apparatus to carry out:
generating a database query based on a state specification of a graphical user interface, wherein the database query is composed to retrieve a current query result from a cloud-based data warehouse;
searching a local cache for the current query result, wherein the cache comprises one or more previous query results from the cloud-based data warehouse;
comparing, during execution of the database query and based on the searching, a computational expense of extracting at least a portion of the current query result from a first query result of the one or more previous query results with a computational expense of extracting the at least the portion of the current query result from at least one other query result of the one or more previous query results;
selecting the first query result in response to the computational expense associated with the first query result being lower than the computational expense associated with the at least one other query result; and
creating the current query result to the portion of the first query result.
12 . The apparatus of claim 11 , wherein:
the cache further comprises a second query result of the one or more previous query results from the cloud-based data warehouse;
determining, based on the searching, that the current query result may be generated to include the portion extracted from the first query result comprises determining that the current query result may be generated as a combination of the first query result and the second previous query result from the cache; and
creating the current query result comprises creating the current query result to include the portion of the first query result and at least the portion of the second query result from the cache.
13 . The apparatus of claim 11 , wherein the computer program instructions further cause the apparatus to carry out providing the current query result via the graphical user interface.
14 . The apparatus of claim 11 , wherein generating the database query comprises limiting the database query based on the portion of the current query result viewable via the graphical user interface.
15 . The apparatus of claim 11 , wherein the apparatus is further caused to carry out determining that the current query result is generated to include a portion extracted from the first query result including determining that a value in the current query result may be calculated based on the first previous query result.
16 . The apparatus of claim 11 , wherein the apparatus is further caused to carry out determining that the current query result is generated to include a portion extracted from the first query result including determining that the first query result is sufficient to calculate an extreme value for a column.
17 . The apparatus of claim 11 , wherein the comparing further comprises dynamically estimated, during execution of the database query, resource utilization for each of the one or more previous query results based on current workload conditions of a query execution engine, wherein the computational expense is based on:
an estimated latency of retrieving the portion from each of the one or more previous query results,
an amount of data to be transferred between a client computing system and an intermediary computing system, and
a number of database operations predicted to be executed by the query execution engine.
18 . The apparatus of claim 11 , wherein the cache is indexed based on database queries keyed to query results.
19 . The apparatus of claim 11 , wherein the database query is generated by:
converting the state specification to an abstract syntax tree;
converting the abstract syntax tree to relational algebra; and
generating the database query from the relational algebra.
20 . A computer program product for evaluating stored query results, the computer program product disposed upon a non-transitory computer readable medium, the computer program product comprising computer program instructions that, when executed, cause a computer to carry out:
generating, by a query execution engine distributed between a client computing system and an intermediary computing system, a database query based on a state specification of a graphical user interface, wherein the database query is composed to retrieve a current query result from a cloud-based data warehouse;
searching, by the query execution engine, a local cache for the current query result, wherein the cache comprises one or more previous query results from the cloud-based data warehouse;
comparing, during execution of the database query and based on the searching, a computational expense of extracting at least a portion of the current query result from a first previous query result of the one or more previous query results with a computational expense of extracting the at least the portion of the current query result from at least one other query result of the one or more previous query results;
selecting, by the query execution engine, the first query result in response to the computational expense associated with the first query result being lower than the computational expense associated with the at least one other query result; and
creating the current query result to the portion of the first query result.