Abstract:
An arrangement for archiving data in a relational database is disclosed. The arrangement includes a first table having a first data field. A value in the first data field is updated by a Relational Database Management System (RDBMS) associated with the relational database when there is a change in the value in the first data field. The arrangement further includes a second table having a second data field represented by a lookup function. The lookup function references the first data field. The lookup function acquiring the value in the first data field for use as a value of the second data field only when a value of the second data field is required by an application program that operates on the relational database.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to active data. More particularly, the present invention relates to methods and apparatus for efficiently updating and employing active data in for example business intelligence systems. 
     Relational databases have long been employed to archive mission-critical data. Relational databases offer reliable storage, with vendors supporting architectures that provide redundancy to ensure uninterrupted service and no loss of data. Relational databases also support the Structured Query Language (SQL) that allows user to store, retrieve and/or modify data in a relatively straight forward manner. Most Relational Database Management System (RDBMS) vendors also support the concept of triggers. A trigger may be thought of as a notification mechanism that is activated when data is changed in the database. Many user applications include the trigger feature, thereby making relational databases a popular choice for data archival among application developers. 
     Active data, however, poses a significant challenge for software developers, and particularly for relational database developers, due to the sheer volume of data involved. Active data may be defined as data that changes on short or regular interval. The duration of the interval may be as short as a millisecond, for example. The opposite of active data is static data: data that does not change on a regular basis or data that changes with long periodicity. Active data is also referred to as real-time data. Examples of active data may include, for example, the sales transactions in a store, the exchange rate of the US dollar versus other currencies like the Euro or the Canadian dollar, and the like. 
     The volume involved when dealing with active data can be daunting from both a historical perspective (i.e., the historical records of change in values represented by a variable) and a runtime perspective (i.e., updating the database to keep up with the pace of change). By way of example, consider a typical large company stock on a major trading board. The stock may be held by millions of customers, many of whom depend on the up-to-the-minute stock price data for their trading decisions. Thus, a change in the value of such a stock may require millions of updates to the portfolios of millions of customers per second. 
     Relational database developers have long relied on data normalization as a technique to optimize the task of updating data for short and frequent transactions, such as the task of updating the aforementioned change in a stock price. For these transactional or operational systems, the goal is to reduce the duplication of data among tables. Upon being normalized, the data of a database is isolated in a large number of tables, but a given data value is kept in only one or a few tables so that fewer tables will require updating when a change occurs. 
     Using the aforementioned stock price updating example, a relational database developer may normalize the data tables such that only one or two source tables need to be updated when the stock price changes. Using primary key-foreign key specifications, other tables (such as the millions of tables representing the portfolios of individual customers) may be provided with a reference to the appropriate field(s) in the source table(s). Accordingly, there is no need to update the millions of tables representing the portfolios of individual customers when the price of a stock changes, which could happen from second to second. The concepts of primary key and foreign key are extremely well known in the relational database art and will not be further explained here for brevity&#39;s sake. 
     Data normalization, however, vastly reduces the efficiency of another class of applications, known as business intelligence applications or systems. In business intelligence applications (which includes analytical applications and/or reporting applications for the purpose of the present disclosure), the database is employed as a support tool, or a data depository, to answer business questions (e.g., how many widgets were sold by stores A, B, and C on January 10th?). Since data normalization isolates data in a large number of tables to reduce data duplication among tables, such analysis requires traversing the multitudes of primary key-foreign key relationships of a normalized database in order to materialize the data in the various required data tables for analysis. 
     Such traversal unfortunately are complex and hence takes a large amount of time, and often detrimentally affects the performance of a business intelligence system. For analysts and decision makers who require real-time reporting and/or analysis of active data, the latency involved in traversing the normalized database may be intolerable since the reporting and/or analysis based on the normalized tables may not be able to keep up with the pace of change in the data values. 
     At the opposite extreme is the de-normalized approach, where the data of the database is put back into fewer tables after normalization to support querying and analysis. Although a given data item may be repeated in many different tables, the user application has to deal with fewer tables during querying and/or analysis, and performance is substantially improved. In addition, asking business questions are easier since the traversals are less complex. The de-normalized approach, however, works poorly with active data since updating is complicated by the fact that a large number of tables needs to be updated for each change in a given data item. 
     In view of the foregoing, there are desired improved techniques and arrangements for efficiently supporting both the large number of updates required by the active data and the real-time reporting and/or analysis based on the active data. 
     SUMMARY OF THE INVENTION 
     The invention relates, in one embodiment, to an arrangement for archiving data in a relational database. The arrangement includes a first table having a first data field. A value in the first data field is updated by a Relational Database Management System (RDBMS) associated with the relational database when there is a change in the value in the first data field. The arrangement further includes a second table having a second data field represented by a lookup function. The lookup function references the first data field. The lookup function acquiring the value in the first data field for use as a value of the second data field only when a value of the second data field is required by an application program that operates on the relational database. 
     The present invention teaches a method for archiving data in a relational database. The method includes providing a first table and updating a value in a first data field of the first table, using a Relational Database Management System (RDBMS) associated with the relational database, when there is a change in the value in the first data field. The method further includes providing a second table having a second data field represented by a lookup function. The lookup function references the first data field. The method additionally includes acquiring the value in the first data field for use as a value of the second data field only when a value of the second data field is required by an application program that operates on the relational database. 
     These and other features and advantages of the invention will be discussed in more detail in the following detailed description of the invention and in conjunction with the following figures. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The invention is illustrated by way of example, and not by way of limitation, in the figures accompanying the drawings, and in which like reference numerals refer to similar elements, and in which: 
         FIG. 1  shows, in accordance with one embodiment of the present invention, two data objects, one of which is a source data object and the other is a de-normalized data object containing a lookup function. 
         FIG. 2  shows, in accordance with one embodiment of the present invention, a view of the de-normalized data object of  FIG. 1  as seen by the client application program that has subscribed to its lookup function. 
         FIG. 3  illustrates, in accordance with one embodiment of the present invention, an example of how a lookup function may be employed in a retail scenario. 
     
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     The invention will now be described in detail with reference to a few preferred embodiments, as illustrated in the accompanying drawings. In the following description, numerous specific details are set forth in order to provide a thorough understanding of the invention. It will be apparent, however, to one skilled in the art, that the invention may be practiced without some or all of these specific details. In other instances, well-known process steps and/or features have not been described in detail in order to not unnecessarily obscure the invention. The features and advantages of the invention may be better understood with reference to the drawings and discussions that follow. 
     In accordance with one embodiment of the present invention, there is provided an active lookup mechanism that enables the database to be optimized for updating transactions as well as for supporting querying/analysis. With active lookups, the values of the fields of a lookup column in a data object (such as a table) are given by the values of a column in another data object. Conceptually speaking, a lookup column in a table may be thought of as a function call performed in the context of a data object to lookup a single field in another data object (the foreign or source data object). 
     Although a lookup function may obtain multiple data values associated with multiple fields, for the purpose of the disclosure, it is easier to explain using an example wherein a lookup function is employed to obtain a single value from the source table. The example will be expanded to include the multiple data value lookup later herein. 
     When a change occurs in the value of a data item, for example, that change is updated into a field in one or more source tables, which are normalized for high performance and simplified maintenance. Other tables, which are de-normalized tables optimized for querying/analysis, contain active lookup functions that refer to the value in the source, normalized table. 
     These active lookup functions may be thought of as “virtual data” that need not get updated unless required by an application program that operates on the database. If the application program subscribes to a given lookup function to be notified when there is a change in the value represented by the lookup function, that lookup function will perform the lookup whenever it is notified of a change in the value stored in the source, normalized table. 
     Once the value is obtained by the lookup function, a trigger is activated to inform the application program that the value it subscribes to has changed. In this manner, the notification is cascaded in a transparent manner between the source, normalized table and the application program via the de-normalized table that contains the lookup function. The client application program needs not be aware of the fact that the data comes from a lookup instead of being acquired directly from the de-normalized table. Furthermore, the client application program needs not be aware that the data comes from tables that have been normalized for efficient updating. 
     Lookup functions are particularly efficient when the client application program requires access to only a subset of the data items available in a database. Since the lookup functions in the de-normalized data tables do not get activated unless subscribed to by an application program, effort is not wasted on acquiring and/or updating, in de-normalized tables, values which do not get utilized by a client application program. 
     Further, since certain data items may not get updated often enough to pose a performance problem, they may be populated directly in the de-normalized data tables. Using the previous stock portfolio example, the customer name or the customer address is a data item that is not expected to change frequently and may thus be populated directly into the de-normalized data table, alongside lookup functions that refer to the instantaneous price of a stock, which instantaneous price is populated in the normalized source table. The ability to employ both lookup and non-lookup data in a de-normalized table simplifies the task of developing database tables for developers since it reduces the number of lookup functions that must be created and improves performance since fewer computations are required to update the infrequently changed non-lookup data. 
     In this manner, lookups may be thought of as a hybrid solution that supports data normalization, thereby allowing data to be updated in fewer places. Lookups also supports data de-normalization, thereby facilitating efficient querying/analysis of the data in one data object. As such, lookups are particularly useful in cases where active data is involved since they allow the voluminous number of updates associated with active data to be handled efficiently via the normalized table. At the same time, the efficient querying/analysis capability provided by the de-normalized tables that contain the lookup functions allows the client application to provide real time reporting and/or analysis of the active data to the user. Note that the term “real-time” as employed herein, refers to the substantially or nearly contemporaneous nature of the task to be performed. In the real world, computer code, electrons and circuits involve non-zero delays to accomplish their tasks and thus it is not intended herein that the term represent the concept of zero delay. 
     The features and advantages of the present invention may be better understood with reference to the figures and discussions that follow.  FIG. 1  shows, in accordance with one embodiment of the present invention, two data objects: a source data object  102  and a de-normalized data object  104 . Source data object  102  may be thought of as one of the normalized tables optimized for updating transactional data. Source data object  102  is shown having a primaryKeyName  106  and a fieldName  108 . These are referred to by the foreignKeyName  110  in data object  104 . 
     Conceptually, the lookup may be represented by the following generic function expression. 
     Lookup(foreignKeyName, dataObjectName, primaryKeyName, fieldName), 
     where 
     foreignKeyName represents the name of the field in the current data object that contains a key to the foreign or source data object (dataObjectName); 
     dataObjectName represents the name of the source data object; 
     primaryKeyName represents the name of the primary key in the source data object (dataObjectName); and 
     fieldName represents the name of the field (column) from the source data object to be returned as a result of the lookup function. 
       FIG. 2  shows a data object  202 , representing the data object  104  as seen by the client application program that has subscribed to the lookup function of the example of  FIG. 1 . As mentioned, the client application program needs not be aware of the fact that the data comes from a lookup instead of being acquired directly from the de-normalized table and needs not be aware that the data comes from tables that have been normalized for efficient updating. In other words, as far as the client application program is concerned, the data and the change notification thereof appear to come directly from the de-normalized data object  104  itself despite the fact that the notification is cascaded from source data object  102  and the data itself is obtained by a function call from data object  104  to data object  102 . 
     Note that the keys can be composite keys (i.e., comprises multiple fields). Further, the fieldname  220  can return multiple fields. However, it is important to note that the data associated with lookup functions is not materialized and is not acquired unless the lookup functions are activated by the client application program. Further, the de-normalized table may also contain a mixture of lookup functions and non-lookup (i.e., directly populated and/or updated) data as mentioned earlier. 
       FIG. 3  illustrates an example of the lookup function usage in a retail scenario. In this case, sales of an item (Item  322 ) for certain price (Value  326 ) in the local currency (Currency  324 ) is stored in Sales table  302 . A lookup function associated with Sales table  302  refers to the exchange rate stored in a source table ExchangeRates  304 , which exchange rate is updated continuously in ExchangeRates table  304  as the exchange rate fluctuates. The Converted Value  328  is stored in Sales table  302   
     The following calculation is made in a column of Sales table  302 .
 
Sales.ConvertedValue=Sales.Value*Lookup(Currency,ExchangeRates.Rate).
 
     If the lookup function is activated to by a client application program  306 , a modification in the exchange rate in ExchangeRates table  304  will automatically propagate to the SalesTable  302  where the ConvertedValue  328  is recalculated and propagated to the client application  306  and any other appropriate client application  308  as shown in  FIG. 3 . 
     As can be appreciated from the foregoing, the use of lookup functions accommodates the need to efficiently update the large volume of data associated with active data as well as the need to efficiently query and/or analyze the data. Lookup functions accomplish the former by supporting data normalization, allowing the data to be updated in isolated source tables. Lookup functions also accomplish the latter by supporting data de-normalization. However, since a lookup is not performed unless it is activated or subscribed to by a client application program, the number of lookups tend to be substantially less than the number of data items available in the database since a typical client application usually requires only a small subset of the data items available in the database. Accordingly, effort is not wasted on updating and/or acquiring data items which do not get utilized, rendering it possible to efficiently perform real-time analysis on real time data. 
     While the invention has been described in terms of several preferred embodiments, there are alterations, permutations, and equivalents which fall within the scope of this invention. For example, although the active lookup feature is discussed to be particularly useful with active data, such feature is also useful for archiving any data that changes frequently even though the periodicity of the change may not qualify such data, to some people, as “active data.” It is therefore intended that the following appended claims be interpreted as including all such alterations, permutations, and equivalents as fall within the true spirit and scope of the invention.