# Patent

## Title
Information value-driven near real-time decision support

## Abstract

Information-based decision support may be provided by a query handler configured to receive a query which is applicable against different combinations of a plurality of remote databases and a corresponding plurality of replica databases including at least some replicated data of respective ones of the remote databases, wherein each replica database is synchronized with a corresponding remote database at a plurality of synchronization times and the different combinations include future versions of the replica databases defined by corresponding synchronization times. A query plan generator may be configured to determine information values associated with at least a subset of the different combinations, based on a query value associated with the query and on a diminishment of the query value caused by a corresponding combination, and further configured to generate, based on the information values, a query plan including at least one combination of the different combinations for executing the query therewith.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application claims priority under 35 U.S.C. §119 to Chinese Patent Application No. 200910163949.2, filed on Jun. 12, 2009, titled “INFORMATION VALUE-DRIVEN NEAR REAL-TIME DECISION SUPPORT,” and to U.S. Provisional Application No. 61/220,554, filed Jun. 25, 2009, titled “INFORMATION VALUE-DRIVEN NEAR REAL-TIME DECISION SUPPORT,” which are incorporated herein by reference in their entireties.


TECHNICAL FIELD
This description relates to decision support systems.
BACKGROUND
Human and automated decisions are presumably made using information which may be relevant to the decisions, and/or to the outcomes of the decisions. Decision support thus generally refers to the field of obtaining and providing such information in a manner best-suited to assist in the decision-making Many different fields and settings may benefit from such decision support, including, to name a few examples, the realms of business, legal, educational, governmental, health, military, and personal. In a business setting, for example, an equities manager may wish to make a decision about whether to purchase a particular equity, and may wish to have access to information which may assist in making such a decision.
In an ideal situation, decision makers may easily be presented with exactly the information needed to make the decision(s), e.g., all available information may be up-to-date, and may be parsed such that only desired/necessary information is extracted to be provided to the decision maker. In reality, it is difficult or impossible to reach such an ideal solution. For example, the necessary information may be large in amount, and/or may be distributed across a large geographical area (e.g., in multiple datacenters), perhaps stored in heterogeneous systems. Meanwhile, some information is time critical for some decisions, and therefore rapidly becomes out of date and useless for decision support. On the other hand, other information may remain current almost indefinitely for purposes of making the same or different decision(s). Considering these and other factors, then, it may be seen that it may be problematic to identify and obtain desired information in a time frame necessary to make an acceptable decision.
SUMMARY
According to one general aspect, a computer system including instructions recorded on a computer-readable medium may include a query handler configured to receive a query which is applicable against different combinations of a plurality of remote databases and a corresponding plurality of replica databases including at least some replicated data of respective ones of the remote databases, wherein each replica database is synchronized with a corresponding remote database at a plurality of synchronization times and the different combinations include future versions of the replica databases defined by corresponding synchronization times. The system may further include a query plan generator configured to determine information values associated with at least a subset of the different combinations, based on a query value associated with the query and on a diminishment of the query value caused by a corresponding combination, and further configured to generate, based on the information values, a query plan including at least one combination of the different combinations for executing the query therewith.
Implementations may have one or more of the following features. For example, the query plan generator may include an information value calculator configured to calculate the information values, and the information value calculator may include a computational latency (CL) calculator configured to determine a time between a receipt of a result of the query and an issuance of the query, and a synchronization latency (SL) calculator configured to determine a time between the receipt of the result of the query and a relevant synchronization time of the plurality of synchronization times that is prior to or concurrent with the issuance of the query. Then, the information value calculator may be configured to determine the diminishment of the query value, based on a combination of the computational latency and the synchronization latency. The information value calculator may include a parameter manager configured to determine the query value and decay rates λCL and λSL for defining an extent of the diminishment associated with each of the computational latency and the synchronization latency, respectively. The query plan generator may be configured to determine the information values using the formula IV=QV(1−λCL)CL(1−λSL)SL, where IV refers to the information value and QV refers to the query value.
The system may include a query re-writer configured to convert the query into a time-stamp based query for use by the query plan generator, wherein the time-stamp based query is defined by an earliest last synchronization time stamp among all replicated tables of the replica databases to be involved in the query plan. The system may further include a search space manager configured to reduce a search space of the different combinations to be searched by the query plan generator when generating the query plan, including determining a query plan boundary which excludes combinations having an information value lower than a current optimal information value of a current optimal query plan.
The system may include a workload manager configured to include the query within a group of queries and to determine the query plan as part of an optimization of an information value of the group of queries as a whole. In this case, the workload manager may include a group generator configured to determine a plurality of queries as having associated query plans and time ranges for execution thereof, and to define the group of queries from the plurality of queries, based on an overlap of the time ranges. The workload manager may include a sequence manager configured to optimize the information value of the group of queries including determining a sequence of the queries associated with the optimized information value. In this case, the workload manager comprises a genetic algorithm manager configured to express sequences of the queries of the group of queries as chromosomes, and configured to evaluate the chromosomes to obtain a subset for recombination thereof into a next generation of chromosomes.
According to another general aspect, a computer-implemented method may include receiving a query which is applicable against different combinations of a plurality of remote databases and a corresponding plurality of replica databases including at least some replicated data of respective ones of the remote databases, wherein each replica database is synchronized with a corresponding remote database at a plurality of synchronization times and the different combinations include future versions of the replica databases defined by corresponding synchronization times, determining information values associated with at least a subset of the different combinations, based on a query value associated with the query and on a diminishment of the query value caused by a corresponding combination, and generating, based on the information values, a query plan including at least one combination of the different combinations for executing the query therewith.
Implementations may have one or more of the following features. For example, in determining information values, a computational latency (CL) may be determined as a time between a receipt of a result of the query and an issuance of the query, and a synchronization latency (SL) may be determined as a time between the receipt of the result of the query and a relevant synchronization time of the plurality of synchronization times that is prior to or concurrent with the issuance of the query. The diminishment of the query value may be determined, based on a combination of the computational latency and the synchronization latency. Further, determining the information values may include determining the query value and decay rates λCL and λSL for defining an extent of the diminishment associated with each of the computational latency and the synchronization latency, respectively.
The query may be included within a group of queries, and the query plan may be determined as part of an optimization of an information value of the group of queries as a whole. Further, determining the query plan as part of an optimization of an information value of the group of queries as a whole may include executing a genetic algorithm used to optimize the information value of the group of queries as a whole including determining a sequence of the queries associated with the optimized information value expressed as a chromosome of the genetic algorithm.
According to another general aspect, a computer program product may be tangibly embodied on a computer-readable medium and may comprise instructions that, when executed, are configured to receive a query which is applicable against different combinations of a plurality of remote databases and a corresponding plurality of replica databases including at least some replicated data of respective ones of the remote databases, wherein each replica database is synchronized with a corresponding remote database at a plurality of synchronization times and the different combinations include future versions of the replica databases defined by corresponding synchronization times, determine information values associated with at least a subset of the different combinations, based on a query value associated with the query and on a diminishment of the query value caused by a corresponding combination, and generate, based on the information values, a query plan including at least one combination of the different combinations for executing the query therewith.
Implementations may include one or more of the following features. For example, the instructions, when executed, may be configured to determine the information values including determining a computational latency (CL) as a time between a receipt of a result of the query and an issuance of the query, and determining a synchronization latency (SL) as a time between the receipt of the result of the query and a relevant synchronization time of the plurality of synchronization times that is prior to or concurrent with the issuance of the query. The information values may be calculated using the formula IV=QV(1−λCL)CL(1−λSL)SL, where IV refers to the information value, QV refers to the query value, and λCL, λSL are decay rates defining an extent of the diminishment associated with each of the computational latency and the synchronization latency, respectively.
The details of one or more implementations are set forth in the accompanying drawings and the description below. Other features will be apparent from the description and drawings, and from the claims.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of an information-value driven decision support system.
FIG. 2 is a flowchart illustrating example operations of the system of FIG. 1.
FIG. 3 is a block diagram of tables used to execute time-stamp based join operations in the system of FIG. 1.
FIG. 4 is a timing diagram illustrating sample execution scenarios for queries of the system of FIG. 1.
FIG. 5 is a block diagram of first example query plans from which the system of FIG. 1 may select.
FIG. 6 is a block diagram of second example query plans from which the system of FIG. 1 may select, illustrating management of the search space of the query plans when selecting an optimal query plan.
FIG. 7 is a flowchart illustrating example operations of the system of FIG. 1 when selecting a query plan(s) of FIGS. 5 and 6.
FIG. 8 is a block diagram illustrating an example combination of chromosomes used in the system of FIG. 1 when optimizing a workload of multiple queries.
FIG. 9 is a flowchart illustrating example operations of the system of FIG. 1 when optimizing a workload of multiple queries as in FIG. 8.
FIG. 10 is a flowchart illustrating example operations of the system of FIG. 1 including the operations of FIG. 7 and FIG. 9 as sub-operations thereof.



DETAILED DESCRIPTION
FIG. 1 is a block diagram of a system 100 for providing information-value driven decision support. In the example of FIG. 1, a decision support system 102 is illustrated which receives at least one query 104, and which provides information 106 in return. As may be appreciated, the information 106 may then be used by a human or automated user in making some relevant decision.
In FIG. 1, the decision support system 102 provides the information 106 in a manner that optimizes a value of thereof for a particular decision. For example, the decision support system 102 recognizes that the information 106 has a particular value to a decision maker, and that such value may be diminished or reduced in various ways, due to, e.g., system constraints that may exist when providing the information 106. For example, the value of the information 106 may be diminished due to a delay of the system 100 in providing the information 106, where such delay, if large enough, may cause the value of the information 106 to reduce to zero (e.g., when the information 106 is completely out of date, or when the decision maker has a deadline for the decision that passes before the information 106 is provided).
The system 100 of FIG. 1 illustrates that the decision support system 102 may have access to a remote database 108a, which may be replicated locally to the decision support system 102 as a replica database 108b. Similarly, the decision support system 102 may have access to a remote database 110a, which may be replicated locally to the decision support system 102 as a replica database 110b. In practice, the replica databases 108b, 110b may replicate all or only a portion of their respective remote databases 108a, 110a. Moreover, it will be appreciated that additional remote databases may be accessed by the decision support system 102 (although such additional remote databases are not specifically illustrated in FIG. 1 for the sake of conciseness), and that some or all of such additional remote databases may have some or all of their contents replicated to corresponding replica databases that are local to the decision support system 102.
One function of the decision support system 102 may thus include selecting an optimal query plan for executing to query 104 against a subset of the databases 108a, 108b, 110a, 110b so as to optimize the final value of the information 106. For example, a first such query plan may include executing the query 104 against the replica database 108b and the remote database 110a, while a second such query plan may include executing the query 104 against the replica database 110b and the remote database 108a. More generally, the decision support system 102 may determine a subset or combination of relevant, available databases, against which the query 104 may be executed in such a fashion as to obtain an optimal or near-optimal value of the information 106.
As referenced above, decision support system 102 may be implemented in virtually any setting where decision-making is implemented based on available stored or otherwise-obtained information, including the realms of business, legal, educational, governmental, health, military, and personal decisions. Other more specific examples include logistic, power grid, insurance (e.g. fraud detection), and finance (i.e. asset exposure and positioning, and short term financial planning) decisions. For purposes of consistency and clarity in the present description, specific examples will be given to the realm of business decisions, and, in particular, to financial decisions. However, it will be appreciated that the described concepts may easily be extended to different desired settings.
In this regard, the system 100 reflects the fact that many large companies, especially those in financial service sectors, approach the market with a decentralized management structure, such as by line of business or market segment. These companies require access to distributed and possibly heterogeneous data warehouses for business intelligence applications. Such companies seek to balance the central management control while constraining expenses, and, at the same time, maintain the flexibility for each line of business to react, service and sell to its segment of the market.
Thus, FIG. 1 reflects a setup which allows business transactions to be executed at remote locations (e.g., branch level offices, which would be understood to house remote databases 108a, 110a in FIG. 1) while decision-making and complex business operation analysis tasks are performed at the headquarters. In some cases, it is important for such central decision-making and analysis to be executed using real-time or near real-time data, while in the same or other cases, it may be important to obtain access to the necessary data as quickly as possible (e.g., in advance of an imminent deadline).
It is possible to warehouse effectively all available data at a central site, but such an approach is sub-optimal when real-time or near real-time decisions are desired. On the other hand, it is possible to receive queries at such a central site and disperse the resulting multiple queries to remote databases. Although the latter approach has the advantage of providing more up-to-date data, it may be difficult to continuously manage interactions of complex queries involving multiple sites, particularly at large scales. FIG. 1 thus represents a hybrid approach in which the decision support service 102 is at a central site relative to remote databases 108a, 110a, and is configured to replicate relatively small sets of frequently-accessed data to the replica databases 108b, 110b. 
As referenced above, users (decision-makers) of the DSS 102 may be concerned with one or both of how fast and how recent the obtained data are. That is, for example, such users care about not only the response time but also the time stamp of a business operation report. For example, when an inquiry is submitted, a report, report 1, returned after 5 minutes with data time stamped 8 minutes ago has more accurate information than a report, report 2, returned after 2 minutes generated based on data time stamped 12 minutes ago. However, the report generated in 2 minutes may be sufficiently valuable due to its relative timeliness.
The two types of uncertainty just described are referred to herein as computational latency (CL) and synchronization latency (SL). In this regard, computational latency refers to an amount of time from submission/issuing of the query 104 to retrieval/receipt of the resulting information 106, and may refer to any formulating, processing, transmitting, or any other computing operations that cause the information 106 to be received less than instantaneously. For example, the computational latency may be considered to include a summation of query queuing time, query processing time, and query result transmission time, where all these three values are measured by elapsed time, and where the query result transmission time is measured only for the queries running at remote servers. Computational latency results in uncertainty and risks due to not being able to make any decision (e.g., when a deadline is missed or the information 106 is otherwise received late).
Synchronization Latency (SL) refers to an amount of time from a most recent (or most relevant) synchronization of one of the replica databases 108b, 110b until the information 106 is received. For example, if the replica database 108b is updated at noon, the query 104 is submitted at 12:30, and the information 106 is received at 1:00, then the resulting synchronization latency would be an hour. Synchronization latency results in uncertainty and risk due to decision-making based on information that is outdated. It should be appreciated that computational latency and synchronization latency could and most likely will overlap.
Further examples of computational latency and synchronization latency are provided below (e.g., with respect to FIG. 4). In general, though, it may be appreciated that the DSS 102 of FIG. 1 may be operated so as to maximize, minimize, or otherwise balance these latencies and other factors which may impact the value of the information 106. For example, if the DSS 102 routes the query 104 to the replica databases 108b, 110b, then computational latency may be minimized (since the databases 108b, 110b are local to the DSS 102). On the other hand, if the DSS 102 routes the query 104 to the remote databases 108a, 110a, then synchronization latency may be minimized (since the databases 108a, 110a contain up-to-date data). Meanwhile, routing the query 104 to a combination or subset of the databases 108a, 108b, 110a, 110b may provide a balance between computational and synchronization latencies which may be most beneficial to providing the information 106 with a highest-possible value.
The DSS 102, in operation, thus receives the query 104 via a query handler 112, and a query plan generator 114 then formulates a decision as to how to route the query 104 within and among the databases 108a, 108b, 110a, 110b. More specifically, the query plan generator 114 determines which of the databases 108a, 108b, 110a, 110b should receive the query 104, and when the query 104 should be routed to a selected one of the databases 108a, 108b, 110a, 110b (e.g., whether to route the query 104 immediately or to wait for a future data synchronization before routing the query 104).
In order to formulate such a query plan, the query plan generator 114 seeks to maximize a value of the resulting information 106, i.e., seeks to determine an information value IV that reflects information best-suited to the decision-maker submitting the query 104. Eq. 1 represents an example technique for formulating such an information value:

IV=BV(1−λCL)CL(1−λSL)SL  Eq. (1)

In Eq. (1), IV refers to the information value, while BV refers to a business value of the information. CL and SL refer to computational latency and synchronization latency, respectively, and the terms λCL and λSL refer to discount rates assigned to the respective type of latency. Thus, in practice, the term BV reflects the fact that some decisions (and supporting information) may be more important than others, either objectively or subjectively for a particular user. Such a business value (where, again, the reference to such a value in the business realm is but one example, and the more generic term value may be used in a more widely-applicable sense) thus represents a starting point or maximum value which might theoretically be obtained if CL and SL were zero (the ideal scenario where all data is fresh and up-to-date and obtained immediately). Of course, in practice, the values of CL and SL will not be zero, so that their magnitude and the magnitude of the decay rates λCL, and λSL reflect an extent to which these various parameters decrease the information value IV for a particular user over a corresponding time frame.
By way of further discussion of relevant notations, in the present description replica databases such as the replica databases 108b and 110b may be referred to as R1, R2 . . . Rn, while remote databases such as the remote databases 108a, 110a may be referred to as T1, T2 . . . Tn. Thus, it may be stated that the query plan generator 114 is configured to generate a query plan which determines a use(s) of databases (R1, R2, T1, T2) such that IV is maximized for the information 106.
That is, as already referenced, when replica databases 108b, 110b are available, there are multiple plans (i.e., combinations of databases) for processing a query. For example, for a query with a join operation on T1 and T2, and assuming momentarily that the query 104 will be submitted immediately with no delay until a next synchronization, there are four query processing plans: (T1, T2), (R1, T2), (T1, R2), and (R1, R2). One such query processing scheme would select (R1, R2) over the other three plans for the single reason of better response time. However, with respect to the information value of the query result, (R1, R2) may not be the best choice since it may generate a lower information value than other plans, e.g., if R1 and R2 have been out of synchronization for a while. The DSS 102 and the query plan generator 114 thus operate to select a query plan that maximizes the information value IV.
In some implementations, it may be advantageous to at least consider delaying submission of the query. For example, it may occur that the replica database 108b was last synchronized fifty-eight minutes ago and is scheduled to synchronize every hour. In this case, waiting an additional two minutes (and thereby adding two minutes of computational latency) may be worth it to obtain a corresponding (and much larger) reduction in the synchronization latency, since the query 104 would be executed against freshly-synchronized data. Waiting for synchronizations in the manner may be analogized to using a different version (i.e., a future version) of the replica database in question. Then, as a matter of notation, such a future version of a replica database may be denoted as R1′ for a first future synchronization, R1′′ for a second future synchronization, and so on. In effect, such future versions become additional candidate databases for forming possible combinations and associated query plans. For example, in addition to the four combinations referenced above, additional combinations of databases may be considered to be available, including, e.g., (R1′, T2) or (T1, R2′′).
Further in FIG. 1, a workload manager 116 is configured to consider that the query 104 may represent a plurality of queries, and, more specifically, is configured to optimize the information value of a set or workload of multiple queries as a whole. For example, a query plan for a first query may yield a high IV for resulting information, but, e.g., due to constraints imposed on the system 100 by the processing of this first query, a second query may experience a very long computational latency which may severely reduce the IV if its resulting information. Consequently, in these and other examples, the workload manager 116 may be configured to select a sequence of a plurality of set of queries which optimizes the information value of the set as a whole. Operations of the workload manager 116 are described in more detail below, and, in particular, are discussed in detail with respect to FIGS. 8 and 9, below.
During operation of the DSS 102, then, the query 104 is received at the query handler 112, which routes the query 104 and associated information to one or both of the query plan generator 114 and the workload manager 116. In this regard, and turning to more detail of the query plan generator 114, a query re-writer 118 may be included and configured to rule out, during the generation of the query plan(s), the possibility of the information 106 being incorrect due to, for example, different synchronizations or synchronization rates of the databases 108a, 108b, 110a, 110b. For example, the replica database 108b may be synchronized with the remote database 108a at a certain time, while the database 110b may be synchronized with the remote database 110a at a later time. In an intervening time between the two synchronizations, the data in one or both databases 108a, 110a may change. As a result, for example, the combination of such out-of-date data with altered-in-the-meantime data may cause the information 106 to be factually incorrect, e.g., may return a result that does not match any actual scenario of the data.
In general, the query re-writer 118 of the DSS 102 of FIG. 1 may be configured to examine such data and to ensure that within a dataset being examined (e.g., merged or joined), all the data are selected using the earliest timestamp thereof. That is, the query re-writer 118 contemplates the possible use of relatively older data than might otherwise be available (and thereby incurring additional synchronization latency), in order to ensure consistent and correct results.
In particular, the query re-writer 118 may maintain and consult a synchinfo table 120 that tracks timestamps of synchronized data (i.e., tracks specific times at which each piece or set of data was synchronized). Further, the query re-writer 118 may use the synchinfo table 120 based on what operation is desired to be performed (e.g., insertion versus deletion of data) in order to minimize the amount of additional synchronization latency that is tolerated for the purpose of maintaining consistency of the information 106. Specific examples of the use and operation of the query re-writer 118 and the synchinfo table 120 are provided below, e.g., with respect to FIG. 3.
Upon re-writing, the query 104 may be passed to an information value calculator 122, which, as already described, is configured to consider possible query plans and to assign an information value IV to each one, using Eq. (1), above. In this regard, the information value calculator 122 may include a parameter manager 124 that is configured to receive, calculate, or otherwise determine parameters that may be specified by, or derived from, preferences of the relevant user (decision-maker). In the example of Eq. (1), these parameters include the business value BV and the decay rates λCL and λSL.
For any of these parameters, the parameter handler 124 may simply receive values and preferences (e.g., priority levels) directly from the relevant decision-maker, e.g., by way of an appropriate graphical user interface (GUI) for receiving such preferences. In other examples, various rules, criteria, and/or conditions may be in place which the parameter manager 124 may use to derive or determine one or more of the parameters.
For example, the business value BV may be a relative term normalized to a value between 0 and 1. For a particular query and associated data, the parameter manager 124 may access rules and/or determine current conditions of the system 100 to assign a value to BV. For example, queries related to inventory may be assigned a higher BV than queries related to human resources. Or, queries submitted by a particular user (e.g., a CEO) may automatically be assigned a higher BV. The value for BV may be adjusted higher or lower for a certain query if the system 100 is particularly highly-utilized at the moment, or differently if the system 100 is not being highly-utilized.
Somewhat similarly, the decay rates λCL and λSL may be received directly from the decision-maker or other user. It may be appreciated from the nature of Eq. (1) that assigning higher decay rate(s) alters a relative importance or impact of the CL or SL. For example, if the information 106 is associated with an imminent deadline, then the decay rate λCL may be increased, while the decay rate λSL may be relatively decreased. On the other hand, if there is no imminent risk of the information 106 being late, but if it is important that the information 106 be up-to-date (fresh), then the value of the decay rate λSL may be increased relative to that of the decay rate λCL. In a third example, both decay rates λCL and λSL may be relatively large so that the overall IV will decay relatively rapidly overall.
As with the business value BV, the decay rates λCL and λSL may also be calculated from a set of rules, conditions, or criteria. For example, certain types of queries may be known to be related to content having frequent or imminent deadlines, which may be reflected in calculation of the decay rate λCL. Similar comments apply to queries related to subject matter typically requiring very up-to-date or fresh data with respect to the impact on selection of decay rate λSL.
The information value calculator 122 further includes a CL calculator 126 and a SL calculator 128 to determine the computational latency and synchronization latency, respectively. Such calculations may be executed using known factors and techniques in the manner(s) described herein, are discussed in greater detail below (e.g., with respect to FIGS. 3 and 4), and consequently are not discussed here in detail for the sake of clarity and conciseness.
Although the example of FIG. 1 illustrates a simple example including only two remote databases and two replica databases, it may be appreciated that a larger number of databases may be contemplated and used. Consequently, a number of possible combinations of databases for inclusion in potential query plans may rise exponentially for situations with such relatively large numbers of databases.
Thus, in FIG. 1, a search space manager 130 may be configured to limit a search space of possible combinations of databases when optimizing information value for available query plans. In particular, as discussed in greater detail with respect to FIG. 6, the search space manager 130 may implement a scatter-and-gather algorithm which selects a current optimal query plan, and then rules out query plans which are thought not to be better than the current optimal query plan, and then determines if a new optimal query plan is available within the remaining available query plans.
This process may be repeated until a search space of query plans is sufficiently restricted to allow examination and calculation of the final optimal query plan. In this regard, a query plan selector 132 may be used to determine whether and when the search space is sufficiently restricted, and to select the final optimal query plan from remaining query plans at that time.
As referenced above, when multiple queries (e.g., 104 and 104′) are submitted, the query plan generator 114 may determine at least one possible query plan for each query. Then, it may occur that one such query may be scheduled or planned to start prior to finishing of the other query, so that, in this sense, the two queries overlap. In such a situation, the queries may compete for resources of the system 100, and, if such competition is left unconsidered, the decision-maker may obtain an undesired result. For example, as already referenced, the resource competition may increase a computational latency of one of the queries to a point where its information value is decreased to an unacceptable level. These and other factors which may impact information value(s) of a query or group of queries may be managed, e.g., by changing a sequence and timing with which the queries are submitted. Therefore, the workload manager 116 may consider such overlapping queries as a group(s) and may seek to sequence each group so as to, e.g., maximize the information value of the group as a whole.
The workload manager 116 is thus illustrated as including a group generator 134 which examines individual queries and determines groups of which may overlap during execution. Then, a sequence manager 136 may examine different sequences of the group of queries to determine which sequence is best. In the latter regard, a genetic algorithm manager 138 may be used to examine a search space of the available sequences by representing the sequences as chromosomes and then implementing an evolutionary process of evaluating the chromosomes using a chromosome evaluator 140 and then combining pairs of the highest-rated of the evaluated chromosomes using a chromosome combiner. In this way, an evolutionary loop is created in which each successive generation of chromosomes, on the whole, is more likely to provide an optimal workload for processing the group of queries to obtain the optimal IV for the workload as a whole. Additional operations of the workload manager 115, including the genetic algorithm manager 138, are described below with respect to FIGS. 8 and 9.
In FIG. 1, the DSS 102 may be executed on a computing device 144, which may represent one or more computing devices, any of which may be used to implement one or more of the components of the DSS 102. For example, as referenced above, the computing device 144 may represent a server that is used to execute a data management system which combines warehousing of data in local replica databases 108b, 110b along with distribution of queries as-needed to remote databases 108a, 110a. The computing device 144 may thus be understood various standard components associated with standard function of a decision support system, including components for, e.g., replicating data, transmitting queries and receiving information (data) in return. The computing device 144 may be understood to further include standard components of one or more database management system(s) which may be used to execute operations (e.g., queries) using the various databases 108a, 108b, 110a, 110b. These and other standard components are not illustrated in FIG. 1 explicitly for the sake of clarity and conciseness.
FIG. 2 is a flowchart 200 illustrating example operations of the system of FIG. 1. In the example of FIG. 2, operations 202, 204, 206 are illustrated as sequential operations. However, it may be appreciated that this is merely for ease of illustration and description, and that in reality the various operations 202, 204, 206 may overlap, or occur in parallel, or (except where specified otherwise) may occur in a different order.
In FIG. 2, then, a query is received which is applicable against different combinations of a plurality of remote databases and a corresponding plurality of replica databases including at least some replicated data of respective ones of the remote databases, wherein each replica database is synchronized with a corresponding remote database at a plurality of synchronization times and the different combinations include future versions of the replica databases defined by corresponding synchronization times (202). For example, the query handler 112 of the DSS 102 may receive the query 104. The query 104 may be applicable against different combinations of the remote databases 108a, 110a, and against corresponding replica databases 108b, 110b. As described herein, each replica database 108b, 110b may be synchronized against their respective databases 108a, 110a, e.g., according to a synchronization schedule(s) which dictates into the future a time and manner in which the synchronizations will occur. The combinations may include combinations (T1, T2), (R1, T2), (T1, R2), and (R1, R2) of the databases 108a, 108b, 110a, 110b, as described above, and also may include additional combinations such as, (R1′, T2), (T1, R2′), and (R1′′, R2′), to name a few, where R1′/R2′ and R1′′ refer respectively to first and second future synchronizations of the replica databases 108b, 110b. FIGS. 5 and 6 provide illustrations of such combinations, as described in detail, below.
Information values associated with at least a subset of the different combinations may be determined, based on a query value associated with the query and on a diminishment of the query value caused by a corresponding combination (204). For example, the query plan generator 114, and in particular the information value calculator 122, may determine a query value associated with the query 104. Such a query value is described herein using the specific example of a business value, but it will be appreciated from the above description that a similar type of query value may be determined for virtually any query in any of the realms in which the DSS 102 is applicable and useful. As described herein, each of the different combinations is associated with a greater or lesser computational latency and/or synchronization latency, which may be used with corresponding decay rates, e.g., as described in Eq. (1), to determine a diminishment or decay of the query value that is associated with each selected combination of the databases 108a, 108b, 110a, 110b (and future versions thereof).
Based on the information values, a query plan may be generated including at least one combination of the different combinations for executing the query therewith (206). For example, the information value calculator 122 may output the information values and the query plan selector 132 may select a query plan using the combination having the highest one of the information values.
FIG. 3 is a block diagram of tables used to execute time-stamp based join operations in the system of FIG. 1. Specifically, as referenced above, FIG. 3 illustrates scenarios which imply use of the query re-writer 118 of FIG. 1.
In FIG. 3, table 108a (i.e., an abbreviated table representing at least some content of the remote database 108a, notated as T1) is synchronized with table 108b (i.e., an abbreviated table representing at least some content of the replica database 108b, notated as R1) at 11:00. Similarly, table 110a (i.e., an abbreviated table representing at least some content of the remote database 110a, notated as T2) is synchronized with table 110b (i.e., an abbreviated table representing at least some content of the replica database 110b, notated as R2) at 10:30.
As shown, the tables 108a, 108b include columns 302, 304, and 306, which respectively list information on a name, stock, and quantity (of stock) for a plurality of persons. Meanwhile, the tables 110a, 110b include columns 312 and 314 respectively list data on a stock and its corresponding price.
As already described, in the system of FIG. 1, replicas are placed at a local server to improve performance of complex queries over distributed databases or other data sources. With the presence of replica databases in the system, as described, the query re-writer 118 may be used to maintain consistence and integrity of the query results as if the query 104 were running over base tables on a single server. The replica databases; however, are synchronized individually and perhaps according to difference schedules. As a result, operations performed on the replica databases 108b, 110b (e.g., a join operation) may result in inaccurate and inconsistent results within the information 106.
For example, in FIG. 3, a decision-maker may issue a query requesting the return of names of all stockholders whose properties are no less than $300,000. If R1 and R2 are chosen to answer such a query because of efficiency considerations, Alice will be returned by joining R1 with R2. As shown, such a join operation results in a tuple indicating Alice owns stock S2 at the price of $20 with quantity of 1,500.
The result, however, may not be true in reality given that R1 was last synchronized 30 minutes later than R2 was. In the example of FIG. 3, it may occur that another stockholder, David, sold his 1,500 shares of S2 stock to Alice at 11:00 and at that time, the price of stock S2 has decreased to $18.00 (as shown in T2). Thus, Alice's property has never reached $300,000 and the result derived by simply joining R1 and R2 is inconsistent with reality and should never occur.
It is possible to avoid such an inconsistent result, if feasible and if an associated delay is tolerable, by replicating all databases which are updated in the same transaction to DSS, either all together or not at all. In other implementations, time stamps may be associated with all the database tables, and then operations such as the join operation may be executed based on such timestamps.
In particular, such a time stamp-based join in query processing may contemplate that each replica is associated with a last synchronization time stamp, and each tuple is associated with an insertion time stamp as well as a deletion time stamp, as shown in columns 308/310 and 316/318, indicating a valid life period of that tuple. When a query accesses multiple tables (replicas and/or remote tables) with different last synchronized time stamps, a condition is added by the query re-writer 118 to access only the rows with time stamps consistent with the earliest time stamp among all tables. Such a time stamp-based join operation provides integrity and consistency of results, even when remote tables and replica tables are updated and synchronized independently.
FIG. 3 illustrates that in order to enable consistent join operations regardless of which replica database is used, tuples should be maintained with a deletion time stamp TSdeletion that is later than the earliest last synchronization time stamp among all replica databases. In the example of FIG. 3, R1 is last synchronized at 11:00 and R2 at 10:30, so that tuples with deletion time stamp later than 10:30 should be kept (shown as rows 320, 322, 324, 326 of FIG. 3).
Then, for example, if a user issues a query to return names of all stockholders whose stock portfolio values are no less than $300,000, then if R1 and R2 are chosen to evaluate the query, only tuples with an insertion time stamp earlier than 10:30 and deletion time stamp later than 10:30 should be involved in the join, so that the result includes David, with time stamp 10:30, which is consistent with reality. Thus, the described time-stamp based join contemplates computing a result using a snapshot of all tables at 10:30 to respect consistency.
In practice, the above description should be sufficient to implement one of a number of techniques and implementations for the described time-stamp based join. FIG. 1 above describes one such example, in which an auxiliary table, synchinfo table 120, is maintained at the local server to store and retrieve synchronization information (i.e. the last synchronization time stamp of each replica). The query re-writer 118 may then rewrite a query into a time stamp-based query.
More formally, the user may issue a query involving a number of replica databases and/or remote (base) tables with a form shown in Code section 1:










Code Section 1

















SELECT select-list



FROM Ri1,Ri2,...,Rim, Tj1,Tj2,...,Tjn



WHERE qualification










in which Ri1; Ri2; : : : ; Rim are replica databases and Tj1; Tj2 ; : : : ; Tjn are remote/base tables deployed to evaluate the query. The query may then be rewritten in a manner which realizes the functionality of computing from the synchronization information table 120 the earliest last synchronization time stamp among all replicas involved in the query evaluation.

The query may then be incorporated with the constraints on the time stamps of the tuples, as shown in Code Section 2:










Code Section 2

















Create Procedure EarliestTS(R1, R2,..., Ri)



AS



SELECT @ets = MIN(TSsync)



FROM SyncInfo



WHERE Replica IN(’R1’, ’R2’,...,’Ri’)



RETURN @ets



ets = EarliestTS(Ri, Ri2, ..., Rim);



SELECT select-list



FROM Ri1, Ri2, ..., Rim, Tj1,Tj2, ..., Tjn



WHERE qualification AND









(ets BETWEEN Ri1, TSinsertion, AND Ri1,TSdeletion)AND



(ets BETWEEN Ri2,TSinsertion, AND Ri2,TSdeletion)AND



...



(ets BETWEEN Rim,TSinsertion, AND Rim,TSdetetion)AND



(ets BETWEEN Tj1,TSinsertion, AND Tj1,TSdeletion)AND



(ets BETWEEN Tj2,TSinsertion, AND Tj2,TSdeletion)AND



...



(ets BETWEEN Tjn,TSinsertion, AND Tjn,TSdeletion)










Further, operations such as insertions, deletions, and updates may also be rewritten into time stamp-based operations. For example, for an insert operation, when a tuple is inserted, its insertion timestamp may be set as the time it is inserted, and its deletion time stamp is set as +infinity. For a delete operation, it may be appreciated that deleting a tuple may involve reference to the synch-info table 120. In particular, if such reference reveals that the deleting time is later than the earliest last synchronization time among all replica databases, the tuple to be deleted may be maintained for the time being, and its deletion time stamp may be safely deleted. Otherwise, the tuple can be safely deleted. In a final example, an update operation may be executed by performing a re-write into a delete-and-insert operation. In such an operation, the original tuple may be deleted as described above, and then the tuple with updated value(s) may be inserted.
In FIG. 3, it may be observed that as synchronizations occur, an earliest synchronization time among all replicas may be pushed forward, and tuples with deletion time earlier than the earliest synchronization time may be safely discarded. Thus, a number of deleted tuples maintained to enable time stamp-based join does not necessarily increasing monotonically. In addition, assuming frequent comparisons on the time stamp attributes, indices may be built on these attributes to speed up the query evaluation process.
Using the techniques described above with respect to FIG. 3, formal definitions of computational latency and synchronization latency may be provided for when the time stamp-based join is deployed. Specifically, if a query Q is issued at time stamp tsissue and evaluated using m replica databases Ri1 Ri2, . . . , Rim, with last synchronization time stamps tsi1 . . . tsi2, . . . , tsim, as well as n base/remote tables Tj1, Tj2, . . . , Tjn. Time stamp-based join indicates that the time stamp of the result should be the same as the earliest last synchronization time stamp among all replicas, denoted by tssync=min{tsi1, tsi2, . . . , tsim}. Then, if tsreceive is the time stamp when the query result is received, then the computational latency is CL=tSreceive−tsissue and the synchronization latency is SL=tSreceive−tssync. It may be appreciated that the time-stamp based operations provided with respect to FIG. 3 are merely examples, and that various other techniques may be contemplated to achieve the same or similar results.
FIG. 4 is a timing diagram(s) illustrating sample execution scenarios for queries of the system 100 of FIG. 1. Specifically, FIG. 4 illustrates three query plans 402, 404, 406 for distributing the query 104 in a simple example in which the query 104 is distributed to just a single database (e.g., either the remote database 108a or the local database 108b).
In the query plan 402, the query 104 is sent to the remote database 108a. In the query plan 404, the query 104 is sent immediately to the local, replica database 108b. In the query plan 406, the query 104 is sent to the local, replica database 108b, but is purposefully delayed until an immediately following synchronization time.
Thus, in query plan 402, query execution 408 is started at a time t2 at the same time that the query is issued. The query result (e.g., information 106) is received 410 at a time t3, but with a timestamp t2 representing the time that the retrieved data existed and was in the state as returned to the DSS 102. Consequently, it may be seen that a computational latency 412 occurs which is the difference between times t3 and t2. Moreover, since the remote database 108a is up-to-date by definition, the synchronization latency 414 in this case is the same as the computational latency 412. Thus, executing the query 104 at remote database 108a (e.g., using a corresponding remote server(s)) has the advantage of querying on up-to-date data; however, it will take a longer time in query processing (i.e. longer computational latency than sending the query immediately to the local replica database 108b as in the query plan 404). Nonetheless, since the data at the remote database 108a may change as soon as the query execution at the remote location begins, the query result and the database may be out of synchronization as long as the computational latency, as just referenced and as illustrated in FIG. 4.
In query plan 404, the query is executed at the local replica database 108b. Specifically, query execution 416 again begins at the time t2 when the query is issued, but is received 418 more quickly than in the query plan 402, at an earlier time t4. Here, however, the time stamp of the query result is the time t1, representing a most-recent synchronization of the replica database 108b. Thus, computational latency 420 is reduced to the difference between t4 and t2, while the synchronization latency 422 is increased to the difference between t4 and t1, both as shown in FIG. 4.
Comparing the plans 402 and 404, it may be observed that the plan 402 has a longer computational latency 412 but a shorter synchronization latency 414 than that of the query plan 404. Consequently, if the discount rate of computational latency λCL is smaller than the discount rate of synchronization latency λSL, then according to Eq. (1) above, the query plan 402 may achieve a better information value than the query plan 404. On the other hand, the query plan 404 may generate a better information value if the discount rate of computational latency λCL is larger than the discount rate of synchronization latency λSL. In other words, to maximize information value, the selection between query plans 402, 404 depends the computational latencies and synchronization latencies caused by the two plans, respectively.
In the query plan 406, the query 104 is again issued at the time t2, but query execution does not start 424 until a scheduled synchronization is completed at a time t5. The query result 426 is received at a time t3 having the timestamp of t2, as shown. Thus, computational latency 428 occurs equivalent to the difference between t3 and t2, as shown, while a synchronization latency 430 is defined as a difference between t3 and t5, also as shown.
Thus, the query plan 406 illustrates that when the query 104 is issued between two synchronization cycles (i.e., t1 and t5), then the future version of the replica database 108b that exists once the synchronization is complete may be considered effectively as a separate database to which the query 104 may be sent. In this example, the query plan 406, which delays the execution, introduces more computational latency 428, but with the potential benefit of reduced synchronization latency 430. If the discount rate of synchronization latency λSL is greater than the discount rate λCL of computational latency, then according to Eq. (1), such a delayed plan is probable to generate a greater information value than executing the query 104 immediately, as in the query plan 404.
The examples of FIG. 4 indicate that, to maximize information value in a business or other operation, a proper query plan should be carefully selected. The DSS 102 may thus be configured to select a plan that generates the maximal information value. In this regard, the concept of information value impacts query processing in the DSS 102 by recognizing that executing the query at remote databases may utilize up-to-date data, but may introduce longer computation latency. Executing the query at the local, replica database takes less response time while the drawback is that the replica databases may be out of synchronization for a longer time. Of course, a tradeoff is to leverage the combination of remote and replica databases, as described in more detail below, e.g., with respect to FIGS. 5 and 6. However, no single one of these approaches will always be optimal; rather, maximizing information values also depends on users' preference(s) represented by discount rates of computational latency and synchronization latency, as already described.
Further, as just illustrated, the DSS 102 may be configured to determine a query plan by considering whether the query 104 should be executed at the local replica databases, and, if so, whether to do so immediately or to wait for an upcoming synchronization point(s). As also just described, a reason for considering these options is that delaying a query execution until a future synchronization may possibly result in shorter synchronization latency. Again, user preferences may be incorporated into the information value optimization to determine a proper execution plan that maximizes the information value.
FIG. 5 is a block diagram of first example query plans from which the system of FIG. 1 may select. In FIG. 5, the query plan generator 114 considers query plans for executing the query 104 submitted at a time t1, using the databases 108a, 108b, 110a, 110b of FIG. 1, as shown, where again the databases are respectively referred to notationally as T1, R1, T2, R2. Then, using the notation defined above, a first synchronization of R1 108b occurs at R1′ 502, while a second synchronization of R1 108b occurs at R1′′ 504 and a third synchronization at R1′′′ 505. Similarly, a first synchronization of R2 110b occurs at R2′ 506, while a second synchronization of R2 108b occurs at R2′′ 508. It may be noted that the synchronization cycles/schedules of R1 and R2 are different and independent of one another. Then, in FIG. 5, query plans 511-520 are illustrated as query plans 1-10. For example, query plan 511 is to send the query 104 to the databases (T1, T2), while the query plans 512-520 use, respectively, (R1′, R2′); (R1′, T2); (T1, R2′), (R1′′, R2′); (R1′′, T2); (R1′′, R2′′); (T1, R2′′); (R1′′′, R2′′′), and (R1′′′, T2).
When the query 104 is submitted at time t1, the plans 511-514 are available for immediate execution. FIG. 5 also illustrates the options of delaying execution by waiting for R1′′ to complete at a time t2, at which point the plans 515, 516 become available for immediate execution at time t2. Similarly, when R2′ is synchronized and becomes R2′′, plans 517, 518 become available, and when R1′′ is synchronized and becomes R1′′′, plans 519 and 520 are available. In FIG. 5, query plans 519 and 520 (and any succeeding query plans, not shown) may be immediately discarded because any query plan using time stamps newer than R1′′ 504 and R2′′ 508 will be inferior to plans 511-518 and will have lower information values, regardless of how the discount rates λCL and λSL are chosen. For the same reason, query plans using R2′ 506 and any version prior to R1′ 502.
Although in FIG. 5, eight plans 511-518 are illustrated, the CL calculator 126 need only compile the query 104 four times for the configurations (R1, R2), (R1, T2), (T1, R2), and (T1, T2) to generate their computational latencies. Moreover, the CL calculator 126 needs to perform this calculation only once, and may do so in advance. On the other hand, the SL calculator 128 may calculate synchronization latencies during a plan selection phase for each query plan. Then, the information values for the various query plans may be calculated by the information value calculator 122 using, e.g., Eq. (1). In example implementations, if all queries to be routed are registered in advance and a replication manager (not shown) is deployed to ensure updates to a remote database 108a, 110a is propagated to its replica database 108b, 110b at the DSS 102 within a pre-defined time frame, information values of all queries may be pre-calculated for routing.
FIG. 6 is a block diagram of second example query plans from which the system of FIG. 1 may select, illustrating management of the search space of the query plans when selecting an optimal query plan. For example, the search space manager 130 of FIG. 1 may be configured to execute a scatter-and-gather algorithm or other technique for reducing a search space of possible combinations of databases to use in executing the query 104.
In FIG. 6, consistent terminology with FIGS. 1-5 is used to denote the use of four remote databases T1-T4, along with corresponding replica databases R1-R4. As in FIG. 5, each replica database may be updated and synchronized a plurality of times within a given search space of possible query plan combinations. For example, R1 is synchronized at, e.g., R1′, R1′′, R1′′′. Similarly, R2 is synchronized at R2′, R2′′, R2′′′, and R2′′′′. R3 is synchronized at R3′, R3′′, and R4 is synchronized at R4′ and R4′′.
In FIG. 6, for the sake of example and simplicity, it is assumed that computation latency is 2 minutes if the query evaluation only uses the replica databases R1-R4, and 4, 6, 8, and 10 minutes if the query evaluation involves T1, T2, T3, and T4 remote databases. Further, again for example and simplicity, a decay rate for both λCL and λSL are assumed to be 0.1.
The query is submitted at time stamp 11, and the latest synchronization when the query is submitted is time stamped of R3′ at 8 minutes, as shown. Denoting computational latency CL as “y” and synchronization latency SL as “x,”, Eq. (1) above may be executed as IV=BV(0.9)x(0.9)y.
In execution, in FIG. 6, a current optimal solution is selected. By default, the first such optimal solution may be selected simply using the assumption that the remote databases T1-T4 should be used. Then, for such a current optimal solution with information value IV(opt), then the longest computational latency tolerable to wait for a better solution may be bounded. Specifically, such a determination may proceed from the assumption that if synchronization latency will not result in any discount, there is a maximum computational latency before the information value becomes less than IV(opt). Such a boundary limits the searching space. Then, if a better solution for IV(opt) is found, the boundary may be moved in further.
In a specific example of such techniques, a scatter-and-gather technique is used. During a first (scatter) phase, in FIG. 6, the current time is considered to be 11, when the query is submitted. Again assuming a default optimal plan of T1-T4, it may be seen from the assumptions above that the computational latency is 10, and, since only the remote databases T1-T4 are used, the synchronization latency will also be 10. Thus the information value may be computed as IV(opt)=BV(0.9)10(0.9)10. Thus, it may be observed that the longest computational latency that may occur before the IV(opt) is necessarily reduced is 20 (i.e., adding the exponentials 10+10), so that a first boundary 606 is set at a time of 11+20, or 31, as shown.
Then, during a second (gather) phase, query plan combinations may be computed using the replica databases R1-R4. The gather phase uses the observation that synchronization latency is decided by the earliest synchronized table, which in FIG. 6 is R4 (i.e., R4′). That is, varying the combination of other databases will not generally reduce synchronization latency. For example, using {T1, R2′, R3′, R4′} to evaluate the query will not reduce synchronization latency since R4 is the earliest synchronized and has the most out-of-date data.
Thus, the current order of the replica databases may be recorded as R4′, R1′, R2′, and R3′, as shown in FIG. 6. Then, query combinations and associated information values IV may be calculated by replacing each replica database with its corresponding remote database in each of a plurality of successive query plans. For example, first using R4′ as referenced above in the context of the ordered replica databases, a first query plan may be stated as R4′ R1′ R2′ R3′, so that for x=13, y=2; IV=BV*0.9^(13+2). In this case, a second boundary b 608 in FIG. 6 may be set as b=11+15=26. In a next query plan, R4′ is replaced with T4 resulting in a query plan of T4 R1′ R2′ R3′, so that for x=10, y=4, IV=BV*0.9^(10+4), and thus a third boundary b 610 is b=11+14=25, as shown in FIG. 6. Then replacing R4′ and R1′ with T4 and T1, a query play of T4 T1 R2′ R3′ may be used that for: x=10, y=6, yields boundary b=25 (already shown above), and, similarly replacing R4′′, R1′, and R2′ results in T4 T1 T2 R3′:, so that for x=11, y=8, a boundary b again equals 25.
Thus, the search space has again been reduced, this time constrained to consider only query plans within the boundary b 610 of timestamp 25. The current time line 602 is still at 11, which has obviously not reached the boundary 25, and so the above process repeats. Specifically, the current time line is pushed to the next synchronization point of R4′′ at the timeline 604, and the query plan combinations and associated information values may be computed again in the manner just illustrated.
In particular, the new order is based on the next-earliest synchronization point of R1′, so that the new order is R1′, R2′, R3′, R4′′. For x=9 and y=3, this order results in an information value of IV=BV*0.9^(9+3), so that a new boundary b 612 is determined as b=11+12=23. Similar computations may be made for remaining combinations using the new order but progressively replacing each replica database with its corresponding remote database, as described above.
As the boundary line(s) moves backwards and the current time line forwards, the searching space shrinks dramatically. Further, it may be possible to eliminate other possible solutions which may be observed to be necessarily worse than already-considered query plan combinations. For example, the combination {T1, R2′, R3′, R4′} may be eliminated, since it will not result in a better solution than {R1′, R2′, R3′, R4′}. Such plan eliminations may be useful in further shrinking the search space.
FIG. 7 is a flowchart 700 illustrating example operations of the system of FIG. 1 when selecting a query plan(s) of FIGS. 5 and 6. Specifically, in FIG. 7, the query handler 112 may receive the query 104 to be re-written by the query re-writer 118 using an earliest time-stamp of the replica databases, e.g., R1-R4 (702). Then, a current optimal query plan and associated information value may be determined (704). For example, the search space manager 130 may determine the time of query submission, and the information value calculator 122 may determine the current optimal information value, based on a default combination of using only the remote databases T1-T4.
The current optimal IV may be used to determine an outer boundary line, beyond which no query plan combination will be better than the current optimal solution (706), e.g., using the search space manager 130. New query plan combinations may be determined relative to an earliest synchronization time (database) (708), e.g., by the information value calculator 122. Such query plan combinations may be used again by the information value calculator 122 and the search space manager 130 to determine a new (closer) boundary line (710).
Assuming this new boundary line is not all the way back to the query plan submission time, then the next effective query submission time may be determined (712), by the search space manager 130, based on the next synchronization point. If at this time the search space is sufficiently reduced (714), then the remaining combinations (less any unnecessary combinations that are necessarily worse than the current optimal solution) may be computed and an optimal query plan combination may be selected (716), e.g., by the query plan selector 132. Otherwise, the process continues by determining new query plan combinations based on the current earliest synchronization time (708).
The above operations may be executed by the information value calculator 122 and the search space manager 130 using Algorithm 1, as shown below.










Algorithm 1


Algorithm 1 STQP (Query qi)

















 1: /*Scatter Phase*/



 2: opt = BV × (1 − λCL)x × (1 − λSL)y;



 3: Boundary =x + y + t; /* t is current time*/



 4: /*Gater Phase*/



 5: flag=F;



 6: for (; t < Boundary; ) do



 7:  C.Vary combination order;/*C is the combination



    candidate set*/



 8:  C.Eliminate unnecessary combinations;



 9:  if flag= =F then



10:    Boundary = min{C.Boundaryg}; /* boundary back-



      wards */



11:    flag=T;



12:  else



13:    t=t.getnext;/* current time forewords */



14:    flag=F;



15:  end if



16: end if



17: end for










FIG. 8 is a block diagram illustrating an example combination of chromosomes used in the system of FIG. 1 when optimizing a workload of multiple queries. As referenced above, in addition to query optimization for maximizing information values for individual queries, the DSS 102 includes the workload manager 116 that is configured to generate a schedule that maximizes the information value for a whole workload of queries. The workload manager 116 may assist, for example, in situations in which an optimal query plan for one query may conflict with the optimal query plans of other queries. In such a case, the workload manager 116 may optimize the information value for the workload as a whole, instead of just for an individual query.
The multi-query optimization (i.e. scheduling) generally includes operation of the group generator 134 of FIG. 1 to identify possible conflicting queries and forming a workload for multi-query optimization. For example, for each query, the group generator 134 may access the query plans determined by the query plan generator 114, and may derive a range along the time axis that the query may run. If the ranges of more than two queries are overlapped, then the group generator 134 may group them into a workload.
Then, the sequence manager 136 may generate a workload execution sequence and individual plan for each query in the workload, such that an optimal information value for the workload as a whole is achieved. As already described, the sequence manager 136 may implement such a selection process by using a genetic algorithm manager 138. Such a genetic algorithm manager may implement a genetic algorithm as a computer simulation of Darwinian natural selection that iterates through various generations to converge toward the best solution in the problem space. A potential solution to the problem exists as a chromosome, which, as shown in FIG. 8, here may be represented as an execution sequence for the workload for achieving maximal overall information value.
In FIG. 8, a parent chromosome 802 is illustrated with a second parent chromosome 804, which are then combined to obtain a child chromosome 806. Each chromosome represents an execution order for the workload of queries. As shown, the parent chromosome 802 includes a sequence of Q5, Q3, Q2, Q7, Q9, Q1, Q4, Q0, Q6, and Q8. The parent chromosome 804 includes a sequence of Q3, Q7, Q8, Q0, Q6, Q, Q1, Q4, Q5, and Q9.
FIG. 9 is a flowchart 900 illustrating example operations of the system of FIG. 1 when optimizing a workload of multiple queries as in FIG. 8. In particular, and as referenced above with respect to FIG. 1, the genetic algorithm manager 138 may begin with a random set of chromosomes used to form a first generation (902), such as may include the parent chromosomes 802, 804. Then, this population may be evaluated (904), e.g., by the chromosome evaluator 140. For example, the chromosome evaluator 140 may use combined information values of the workload of each chromosome and then rank these for selection of a most-desired subset.
Then, the selected subset may be broken into pairs, such as the pairs 802, 804, to be recombined into parents of the subsequent generation (906), e.g., by the chromosome combiner 142. Such recombination produces children in a manner that simulates sexual crossover, so that, e.g., mutations may occasionally arise which were not present in the previous generation.
In the example of FIG. 8, as shown, the parent chromosomes 802, 804 may be combined into the child chromosome 806 using a random cut 808 and a random cut 810 for the parent chromosome 802, which provides a slice of sequences (including Q2, Q7, Q9) to be included at the beginning of the child chromosome 806, as shown. Then, the rest of the child chromosome may be completed by disregarding the queries Q2, Q7, Q9 of the slice within the other parent chromosome 804, as shown, and then including remaining queries Q3, Q8, Q0, Q6, Q1, Q4, and Q5 within the remainder of the child chromosome 806. As may be appreciated, many other techniques may be used to execute the re-combinations.
If the genetic algorithm is done (908), then the optimal workload sequence may be selected (910). In this sense, it may be appreciated that a number of factors or metrics may be used to determine whether the genetic algorithm is finished. For example, the genetic algorithm manager 138 may be configured to execute the genetic algorithm for a certain amount of time, or for a certain number of generations. In other situations, an external factor may be received which effectively ends the iterations of the genetic algorithm manager 138, such as, e.g., information that a deadline is imminent which forces the end of the iterations. If the genetic algorithm is not done (908), then the process may continue with evaluation of the new generation of chromosomes (904), so as to select the next set of parent chromosomes for recombination of pairs thereof (906).
Algorithm 2 illustrates operations of the genetic algorithm manager 138 as described above with respect to FIGS. 1, 8, and 9. In the Algorithm, the variable t represents the current generation and P(t) represents the population at that generation.










Algorithm 2


Algorithm 2 Procedure Genetic Algorithm

















1: t = 0;



2: initialize P(t);



3: for ( ;! done; ) do



4:  alter P(t); /* recombine/mutate */



5:  t = t + 1;



6:  select P(t) from P(t − 1);



7:  evaluate P(t);



8: end for










FIG. 10 is a flowchart 1000 illustrating example operations of the system of FIG. 1 including the operations of FIG. 7 and FIG. 9 as sub-operations thereof. In FIG. 10, a query is selected (1002) for processing, e.g., by the query handler 112. Then, a query plan which optimizes the information value of the query may be determined (1004), e.g., using the operations of FIG. 7. A plan time range may be determined (1006), e.g., by the group generator 134, for the query and associated query plan.
If another query is available (1008), the operations continue (1002-1006) until no more queries are available or until it is determined that no more queries of available queries may possible overlap with existing/processed queries. At such time, overlapping queries may be determined and grouped into a workload (1010), eg., by the group generator 134. Then, an optimal execution sequence may be determined (1012), using the operations of FIG. 9.
FIGS. 1-10 and associated description, above, describe and illustrate many different implementations of the DSS 102. Of course, such implementations are merely for the sake of example, and additional or alternative implementations may be used, as well.
For example, the description above provides discussion of pre-registered query workload(s) running periodically in fixed intervals. However, the DSS 102 also may process online arrival ad hoc queries.
In particular, there may be at least two types of online arrival ad hoc queries, e.g., those which arrive for immediate execution, and those which arrive for scheduled execution at a later time, both of which may be handled according to the following.
For ad hoc queries submitted, a query plan selection task is executed and a range is derived along the time axis over which the query may run. If the ranges of more than two queries are overlapped, they may be grouped into a workload as described above. Possible execution plans of all queries may be registered, and when a new ad hoc query arrives, the possible execution range of the new queries may be compared with the ranges of possible execution plans of the registered queries (i.e., instead of ranges of selected plans of the registered queries.) Then, possible conflicting queries may be selected and formed into a new workload group for multi-query optimization.
Then, a workload execution sequence and individual plan may be regenerated for each query in the workload. If conflicting queries are being processed, then running queries may be processed by, e.g., canceling the running queries and regenerating new plans with the new workload group, letting the running queries continue to complete as scheduled, or suspending the running queries and rescheduling the remaining of the query processing steps with the new workload group. In this latter case, all suspended queries may use the same query plans after they are resumed.
The DSS 102 also may be configured to deal with possible starvation scenarios of processing queries and query plans. In this context, starvation refers to the recognition that Eq. (1) for determining the information value favors immediate query execution to avoid decay or diminishment of the business/query value. Thus, it may occur that a query which is queued may continue to be queued essentially indefinitely, since such a query may continually be superseded by new queries with a higher information value. Such starvation may occur in particular when the system 100 is heavily loaded. Such starvation does not impact the achieving an overall optimal information value, but may nonetheless cause dissatisfied users who are required to wait indefinitely for their desired information.
Therefore, as one example way to prevent such starvation, Eq. (1) for calculating information value IV may be adapted to include a function of time values to increase the information value of queries that are queued for a period. Such a function of time value is designed to increase information value faster than the information value would be discounted by SL and CL, in order to advance the query within the queue.
Algorithm 3 illustrates an example algorithm for implementing the operations of FIG. 10, including the just-described considerations of ad hoc online arriving queries and the starvation problem.










Algorithm 3


Algorithm 3 Query Processing (Query Q[q1...qn], Ad


hoc Query AQ[aq1..aqn])


















1:
for Each query qi ε Q do



2:
 P=STQP(qi); /*Find qi's plan & time range*/



3:
end for



4:
W[1].enqueue(q1);



5:
W[1].t = q1.t;



6:
k = 1;



7:
flag=F; /* W is the overlapped query workload*/



8:
for Each i ε 2 [2, n] do



9:
 for Each x 2 ε [1, k] do



10:
  if qi.t ∩ W[x].t ≠ 0 then



11:
   flag = T;/* Have overlap*/



12:
   break;



13:
  end if



14:
 end for



15:
 if flag= =F then



16:
  k++; /* no overlap found, open a new group*/



17:
 end if



18:
 W[x].enqueue (qi);



19:
 W[x].t.update;



20:
 flag=F;/* Update to a bigger range*/



21:
end for



22:
for Each i ε [1, k] do



23:
 Best_Order[i]= MQO(f(t)W[i]); /* Reference Procedure




 genetic algorithm, function f(t) is used to avoid




 starvation problem*/



24:
end for



25:
if AQ.size!=0 then



26:
 for Each aqi ε AQ do



27:
  P=STQP(aqi);



28:
  for Each j ε [1, k] do



29:
   if aqi.t ∩ W[j].t ≠ = 0 then



30:
    W[j].equeue(aqi);



31:
   end if



32:
  end for



33:
 if W[j].status=run then



34:
  Cancel the running query; OR



35:
  Let running query continue to complete as scheduled;OR



36:
  suspending the running query;



37:
  Best_Order[j] = MQO(f(t)W[j]);/* Reschedule*/



38:
 end if



39:
 end for



40:
end if










In Algorithm 3, as may be seen, for each pre-registered query, Algorithm 1 (referred to as Algorithm STQP in Algorithm 3) to select a plan and derive a time range that the query may run, as shown in lines 1-3). Then, the overlapped queries are grouped into a workload W, as shown in lines 4-21. Using a generic algorithm as described above, an optimal workload execution order may be obtained, in which, in order to prevent the starvation problem described above, a time valued function is used to increase the information value of any long-queued queries, as shown in lines 22-24). If ad hoc queries arrive, a plan and time range may be chosen using Algorithm 1 (referred to again as Algorithm STQP) for each ad hoc query. Then, the workload may be determined that the ad hoc queries belong to (Line 26-32). In each workload, the plans may be re-examined. Three policies can be used once the conflicting queries are already being processed, as shown in lines 33-38).
Implementations of the various techniques described herein may be implemented in digital electronic circuitry, or in computer hardware, firmware, software, or in combinations of them. Implementations may implemented as a computer program product, i.e., a computer program tangibly embodied in an information carrier, e.g., in a machine-readable storage device or in a propagated signal, for execution by, or to control the operation of, data processing apparatus, e.g., a programmable processor, a computer, or multiple computers. A computer program, such as the computer program(s) described above, can be written in any form of programming language, including compiled or interpreted languages, and can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A computer program can be deployed to be executed on one computer or on multiple computers at one site or distributed across multiple sites and interconnected by a communication network.
Method steps may be performed by one or more programmable processors executing a computer program to perform functions by operating on input data and generating output. Method steps also may be performed by, and an apparatus may be implemented as, special purpose logic circuitry, e.g., an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit).
Processors suitable for the execution of a computer program include, by way of example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer. Generally, a processor will receive instructions and data from a read-only memory or a random access memory or both. Elements of a computer may include at least one processor for executing instructions and one or more memory devices for storing instructions and data. Generally, a computer also may include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto-optical disks, or optical disks. Information carriers suitable for embodying computer program instructions and data include all forms of non-volatile memory, including by way of example semiconductor memory devices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks, e.g., internal hard disks or removable disks; magneto-optical disks; and CD-ROM and DVD-ROM disks. The processor and the memory may be supplemented by, or incorporated in special purpose logic circuitry.
To provide for interaction with a user, implementations may be implemented on a computer having a display device, e.g., a cathode ray tube (CRT) or liquid crystal display (LCD) monitor, for displaying information to the user and a keyboard and a pointing device, e.g., a mouse or a trackball, by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user can be received in any form, including acoustic, speech, or tactile input.
Implementations may be implemented in a computing system that includes a back-end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front-end component, e.g., a client computer having a graphical user interface or a Web browser through which a user can interact with an implementation, or any combination of such back-end, middleware, or front-end components. Components may be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN) and a wide area network (WAN), e.g., the Internet.
While certain features of the described implementations have been illustrated as described herein, many modifications, substitutions, changes and equivalents will now occur to those skilled in the art. It is, therefore, to be understood that the appended claims are intended to cover all such modifications and changes as fall within the scope of the embodiments.

## Claims

1. A computer system including instructions recorded on a computer-readable medium, the system comprising:
at least one processor processor; and
a query handler configured to cause the at least one processor to receive a query for application against different combinations of a plurality of remote databases and a corresponding plurality of replica databases including at least some replicated data of respective ones of the remote databases, wherein each replica database is synchronized with a corresponding remote database at a plurality of scheduled synchronization times and the different combinations include future versions of the replica databases defined by corresponding synchronization times; and
a query plan generator configured to
cause the at least one processor to determine information values associated with at least a subset of the different combinations using an information value calculator that comprises:
a computational latency (CL) calculator configured to cause the at least one processor to determine a time between a receipt of a result of the query and an issuance of the query for a particular combination;
a synchronization latency (SL) calculator configured to cause the at least one processor to determine a time, for the particular combination, between the receipt of the result of the query and a relevant synchronization time of the plurality of scheduled synchronization times that is prior to or concurrent with the issuance of the query, and
a parameter manager configured to cause the at least one processor to determine decay rates λCL and λSL for defining an extent of diminishment associated with each of the computational latency and the synchronization latency, respectively,
wherein the information value calculator calculates the information value (IV) for the particular combination using the formula IV=QV(1-λCL)CL(1-λSL)SL, where QV refers to a query value associated with the query, and

further configured to cause the at least one processor to generate, based on the information values, a query plan including at least one combination of the different combinations for executing the query therewith.

2. The system of claim 1, wherein the parameter manager is further configured to cause the at least one processor to assign a value to the query value based on rules or current conditions of the system.

3. The system of claim 1 wherein the query value is a relative term normalized to be a value between zero and one.

4. The system of claim 1 further comprising a query re-writer configured to cause the at least one processor to convert the query into a time-stamp based query for use by the query plan generator, wherein the time-stamp based query is defined by an earliest last synchronization time stamp among all replicated tables of the replica databases to be involved in the query plan.

5. The system of claim 1 further comprising a search space manager configured to cause the at least one processor to reduce a search space of the different combinations to be searched by the query plan generator when generating the query plan, including determining a query plan boundary which excludes combinations having an information value lower than a current optimal information value of a current optimal query plan.

6. The system of claim 5 further comprising a query plan selector configured to cause the at least one processor to:
determine when the search space is sufficiently restricted; and
select the query plan from query plans remaining in the search space.

7. The system of claim 1 further comprising a workload manager configured to cause the at least one processor to include the query within a group of queries and to determine the query plan as part of an optimization of an information value of the group of queries as a whole.

8. The system of claim 7 wherein the workload manager comprises a group generator configured to cause the at least one processor to determine a plurality of queries as having associated query plans and time ranges for execution thereof, and to cause the at least one processor to define the group of queries from the plurality of queries, based on an overlap of the time ranges.

9. The system of claim 8 wherein the workload manager comprises a sequence manager configured to cause the at least one processor to optimize the information value of the group of queries including determining a sequence of the queries associated with the optimized information value.

10. The system of claim 9 wherein the workload manager comprises a genetic algorithm manager configured to cause the at least one processor to express sequences of the queries of the group of queries as chromosomes, and configured to evaluate the chromosomes to obtain a subset for recombination thereof into a next generation of chromosomes.

11. A computer-implemented method, comprising:
receiving a query for application against different combinations of a plurality of remote databases and a corresponding plurality of replica databases including at least some replicated data of respective ones of the remote databases, wherein each replica database is synchronized with a corresponding remote database at a plurality of scheduled synchronization times and the different combinations include future versions of the replica databases defined by corresponding synchronization times;
determining information values associated with at least a subset of the different combinations by:
determining a computational latency (CL) for a particular combination as a time between a receipt of a result of the query and an issuance of the query,
determining a synchronization latency (SL) for the particular combination as a time between the receipt of the result of the query and a relevant synchronization time of the plurality of scheduled synchronization times that is prior to or concurrent with the issuance of the query,
determining decay rates λCL and λSL for defining an extent of diminishment associated with each of the computational latency and the synchronization latency, respectively, and
calculating the information value (IV) for the particular combination using the formula IV=QV(1-λCL)CL(1-λSL)SL, where QV refers to a query value associated with the query; and

generating, based on the information values, a query plan including at least one combination of the different combinations for executing the query therewith.

12. The method of claim 11, wherein generating a query plan comprises:
reducing a search space of the different combinations to be searched, including determining a query plan boundary which excludes combinations having an information value lower than a current optimal information value of a current optimal query plan.

13. The method of claim 12, further comprising
determining when the search space is sufficiently restricted; and
selecting the query plan from query plans remaining in the search space.

14. The method of claim 11 further comprising:
including the query within a group of queries; and
determining the query plan as part of an optimization of an information value of the group of queries as a whole.

15. The method of claim 14 wherein determining the query plan as part of an optimization of an information value of the group of queries as a whole comprises:
executing a genetic algorithm used to optimize the information value of the group of queries as a whole including determining a sequence of the queries associated with the optimized information value expressed as a chromosome of the genetic algorithm.

16. A computer program product, the computer program product being tangibly embodied on a computer-readable storage device and comprising instructions that, when executed, are configured to:
receive a query for application against different combinations of a plurality of remote databases and a corresponding plurality of replica databases including at least some replicated data of respective ones of the remote databases, wherein each replica database is synchronized with a corresponding remote database at a plurality of scheduled synchronization times and the different combinations include future versions of the replica databases defined by corresponding synchronization times;
determine information values associated with at least a subset of the different combinations by:
determining a computational latency (CL) for a particular combination as a time between a receipt of a result of the query and an issuance of the query, and
determining a synchronization latency (SL) for the particular combination as a time between the receipt of the result of the query and a relevant synchronization time of the plurality of scheduled synchronization times that is prior to or concurrent with the issuance of the query,
determining decay rates λCL and λSL for defining an extent of diminishment associated with each of the computational latency and the synchronization latency, respectively, and
calculating the information value (IV) for the particular combination using the formula IV=QV(1-λCL)CL(1-λSL)SL, where QV refers to a query value associated with the query; and

generate, based on the information values, a query plan including at least one combination of the different combinations for executing the query therewith.

17. The computer program product of claim 16 wherein the instructions, when executed, are further configured to:
reduce a search space of the different combinations to be searched, including determining a query plan boundary which excludes combinations having an information value lower than a current optimal information value of a current optimal query plan.

18. The computer program product of claim 17 wherein the instructions, when executed, are further configured to:
include the query within a group of queries; and
determine the query plan as part of an optimization of an information value of the group of queries as a whole.