US20070226264A1 - System and method for real-time materialized view maintenance - Google Patents
System and method for real-time materialized view maintenance Download PDFInfo
- Publication number
- US20070226264A1 US20070226264A1 US11/386,346 US38634606A US2007226264A1 US 20070226264 A1 US20070226264 A1 US 20070226264A1 US 38634606 A US38634606 A US 38634606A US 2007226264 A1 US2007226264 A1 US 2007226264A1
- Authority
- US
- United States
- Prior art keywords
- relation
- filtering
- materialized view
- update
- irrelevant
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Abandoned
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2453—Query optimisation
- G06F16/24534—Query rewriting; Transformation
- G06F16/24535—Query rewriting; Transformation of sub-queries or views
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2453—Query optimisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2453—Query optimisation
- G06F16/24534—Query rewriting; Transformation
- G06F16/24539—Query rewriting; Transformation using cached or materialised query results
Definitions
- the present invention relates generally to relational databases and, more particularly, to a system and method for real-time materialized view maintenance for relational databases.
- RDBMS relational database management system
- a real-time data warehouse needs to handle real-time, online updates in addition to the traditional data warehouse query workload. This raises a problem that is present to a lesser degree in traditional data warehouses, namely when a base relation is updated, maintaining the materialized view(s) defined on it can bring a heavy burden to the corresponding RDBMS.
- a method for maintaining a materialized view defined on a relation of a relational database includes the step of performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
- a computer program product including a computer usable medium having computer usable program code for maintaining a materialized view defined on a relation of a relational database.
- the computer program product includes computer usable program code for performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
- a system for maintaining a materialized view defined on a relation of a relational database includes a materialized view manager for performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
- FIG. 1 is a block diagram illustrating an exemplary networked environment to which the present principles may be applied, according to an embodiment thereof;
- FIG. 2 is a block diagram illustrating an exemplary computing device to which the present principles may be applied, according to an embodiment thereof;
- FIG. 3 is a flow diagram for an exemplary method for maintaining a materialized view defined on a relation of a relational database, according to an embodiment of the present principles
- FIG. 4 is a flow diagram for another exemplary method for maintaining a materialized view defined on a relation of a relational database, according to an embodiment of the present principles
- FIG. 5 is a diagram for three exemplary filtering relations, according to an embodiment of the present principles.
- FIG. 6 is a flow diagram for a method for filtering out the irrelevant portion of an update to a materialized view MV, according to an embodiment of the present principles.
- FIG. 7 is a diagram for an exemplary base relation S to which the present invention may be applied, according to an embodiment thereof.
- Embodiments of the present principles are directed to a system and method for real-time materialized view maintenance.
- embodiments of the present principles may be used to identify irrelevant updates to a relation (a base relation or a derived relation) with respect to a materialized view defined on that relation.
- the irrelevant updates are identified more accurately and efficiently as compared to prior art approaches for performing the same.
- FIGURES may be implemented in various forms of hardware, software or combinations thereof. Preferably, these elements are implemented in software on one or more appropriately programmed general-purpose digital computers having a processor and memory and input/output interfaces.
- Embodiments of the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment including both hardware and software elements.
- the present invention is implemented in software, which includes but is not limited to firmware, resident software, microcode, etc.
- a computer-usable or computer-readable medium can be any apparatus that may include, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
- the medium can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium.
- Examples of a computer-readable medium include a semiconductor or solid state memory, magnetic tape, a removable computer diskette, a random access memory (RAM), a read-only memory (ROM), a rigid magnetic disk and an optical disk. Current examples of optical disks include compact disk-read only memory (CD-ROM), compact disk-read/write (CD-R/W) and DVD.
- a data processing system suitable for storing and/or executing program code may include at least one processor coupled directly or indirectly to memory elements through a system bus.
- the memory elements can include local memory employed during actual execution of the program code, bulk storage, and cache memories which provide temporary storage of at least some program code to reduce the number of times code is retrieved from bulk storage during execution.
- I/O devices including but not limited to keyboards, displays, pointing devices, etc. may be coupled to the system either directly or through intervening I/O controllers.
- Network adapters may also be coupled to the system to enable the data processing system to become coupled to other data processing systems or remote printers or storage devices through intervening private or public networks.
- Modems, cable modem and Ethernet cards are just a few of the currently available types of network adapters.
- the environment 100 includes one or more client devices 110 connected to a server 120 via a network 130 .
- the network 130 may include wired and/or wireless links.
- the server 120 may be connected in signal communication with one or more resources 140 .
- the resources 140 may include one or more local and/or remote sources.
- the resources 140 may be connected to the server 120 directly and/or via, e.g., one or more networks 140 (including wired and/or wireless links).
- Each of the client devices 110 may include a materialized view maintenance system 199 (also referred to herein as “materialized view manager”) for maintaining a materialized view as described herein.
- an exemplary computing device to which the present principles may be applied is indicated generally by the reference numeral 200 . It is to be appreciated that elements of the computing device 200 may be employed in any of the client devices 110 , the server 120 , and/or the resources 140 . Moreover, it is to be further appreciated that elements of the computing device 200 may be employed in the materialized view maintenance system 199 .
- the computing device 200 includes at least one processor (CPU) 202 operatively coupled to other components via a system bus 204 .
- a display device 216 is operatively coupled to system bus 204 by display adapter 210 .
- a disk storage device (e.g., a magnetic or optical disk storage device) 218 is operatively coupled to system bus 204 by I/O adapter 212 .
- a mouse 220 and keyboard 222 are operatively coupled to system bus 204 by user interface adapter 214 .
- the mouse 220 and keyboard 222 are used to input and output information to and from system 200 .
- At least one speaker (herein after “speaker”) 297 is operatively coupled to system bus 204 by sound adapter 299 .
- a (digital and/or analog) modem 296 is operatively coupled to system bus 204 by network adapter 298 .
- filtering relations that summarize the most relevant information in the base relations and fulfill pre-specified requirements such as, but not limited to, the four illustrative requirements described herein. These filtering relations capture the relationship among multiple join attributes and can be efficiently maintained in real time.
- the RDBMS uses the corresponding filtering relations of the other base relations of the MV to determine whether or not ⁇ R is irrelevant.
- the checking of filtering relations is usually significantly faster than checking base relations.
- filtering relations can provide more precise information about whether or not ⁇ R is irrelevant. In this way, the RDBMS can quickly and more precisely detect irrelevant updates to R and hence reduce the materialized view maintenance overhead.
- one or more of the following four illustrative requirements may be used to design effective summary data structures: compactness; association; a high filtering ratio; and easy maintenance.
- the present invention is not limited to only these four illustrative requirements and, given the teachings of the present invention provided herein, one of ordinary skill in this and related arts will contemplate these and various other requirements for implementing content-based filtering for materialized view maintenance, while maintaining the scope of the present invention.
- different implementations of any of these same four requirements may also be implemented in accordance with the present principles, while maintaining the scope of the present principles.
- our method in the case that ⁇ R is irrelevant, with high probability p, our method can determine that ⁇ R is irrelevant; with low probability 1-p, our method indicates that it does not know whether ⁇ R is irrelevant.
- the summary data structures are preferably small as they are likely to be cached in memory.
- compactness can be an issue in achieving real-time results.
- the summary data structures preferably capture the relationship among multiple join attributes of a base relation. That is, given a join attribute value (e.g., S.b of the MV in the introduction), we can use the join attribute value to find the associated values of other join attributes (e.g., S.c).
- a join attribute value e.g., S.b of the MV in the introduction
- the summary data structures can preferably quickly and correctly filter out most (or all) of the irrelevant updates to the base relations of a join view.
- the summary data structures are preferably efficiently maintained in real time.
- Operation O 1 Update the filtering relation FR i accordingly.
- Operation O 2 To detect whether or not ⁇ R i is irrelevant, use the where clause condition in the JV's definition and techniques such as, but not limited to, those described by the following, which are each incorporated by reference herein: Blakeley et al, “Updating Derived Relations: Detecting Irrelevant and Autonomously Computable Updates”, TODS 14(3): 369-400, 1989; Blakeley et al., “Efficiently Updating Materialized Views”, SIGMOD Conf. 1986: 61-71; and Levy et al., “Queries Independent of Updates”, VLDB 1993: 171-181.
- Operation O 3 If Operation O 2 cannot tell that ⁇ R i is irrelevant, then check the filtering relations FR 1 , FR 2 , . . . FR i ⁇ 1 , FR i+1 , FR i+2 , . . . , and FR n to determine whether or not ⁇ R i is irrelevant.
- Operation O 4 If Operation O 3 cannot tell that ⁇ R i is irrelevant, then check base relations R 1 , R 2 , . . . , R i ⁇ 2 , R i+1 , R i+2 , . . . , and R 1 to determine exactly whether or not ⁇ R i is irrelevant. In the case that ⁇ R i is relevant, the JV is refreshed. Operation O 4 is the standard join view maintenance method.
- a method for maintaining a materialized view defined on a relation of a relational database is indicated generally by the reference numeral 300 .
- the relation may be a base relation or a derived relation (i.e., a relation derived from a base or other relation).
- the method of FIG. 3 is described particularly with respect to Operation O1 and Operation O 3 above, which illustrate operations performed in accordance with embodiments of the present principles.
- the filtering relation data structure(s) may be created at step 305 to be capable of being shared among multiple materialized views.
- Update the filtering relation data structure(s) e.g., per Operation O 1 described herein (step 306 ).
- Step 307 Compress, reduce the number of, and/or otherwise modify the filtering relation data structure(s) (step 307 ).
- Step 307 may be performed, e.g., to enhance a result of the content-based filtering performed at step 310 , as described in further detail herein below.
- step 310 Perform content-based filtering on the relation, using the filtering relation data structure(s), to identify an update to the relation as being irrelevant with respect to the materialized view (e.g., per Operation O 3 described herein) (step 310 ).
- step 320 Perform a load shedding operation on the relational database based upon a result of the estimate performed at step 315 (step 320 ).
- the update that is identified as being irrelevant or a portion thereof identified as being irrelevant is filtered out or otherwise omitted from the materialized view (step 340 ).
- steps 307 , 315 , 320 , 325 , 330 , and 335 are optional. Thus, one or more of steps 307 , 315 , 320 , 325 , 330 , and 335 may be omitted in some embodiments of the present principles.
- FIG. 4 another method for maintaining a materialized view defined on a relation of a relational database is indicated generally by the reference numeral 400 .
- the relation may be a base relation or a derived relation (i.e., a relation derived from a base or other relation).
- the method of FIG. 4 is described to illustrate a particular embodiment that involves the present principles (e.g., Operations O 1 and O 3 ) and, optionally, various aspects of the prior art (e.g., Operations O 2 and O 4 ).
- Update the filtering relation(s) e.g., per Operation O 1 described herein (step 405 ).
- step 410 Use the where clause condition in the join view's definition to determine whether or not ⁇ R i is irrelevant (e.g., per Operation O 2 described herein) (step 410 ).
- step 420 check the filtering relation(s) to determine whether or not ⁇ R i is irrelevant (e.g., per Operation O 3 described herein) (step 420 ). It is then determined whether or not ⁇ R i has been deemed irrelevant, based on the checked filtering relations (step 425 ). If so, then the method is terminated. Otherwise, check the base relations to determine whether or not ⁇ R i is irrelevant (e.g., per Operation O 4 described herein) (step 430 ).
- C w is the where clause condition in the definition of the join view JV.
- C w is rewritten into a conjunction of m terms c i (1 ⁇ i ⁇ m).
- c i belongs to one of the following three categories:
- R j .a 2 R k .b 2 . . .
- R j .a h R k .b h (h ⁇ 1).
- i's (1 ⁇ i ⁇ m 1 ) either the corresponding j's or the corresponding k's are different.
- c i is a selection condition on a single base relation R j (1 ⁇ j ⁇ n). For different i's (m 1 +1 ⁇ i ⁇ m 2 ), the corresponding j's are different.
- a first filtering relation FR R is shown with respect to an attribute a and an index on attribute a.
- a second filtering relation FR S is shown with respect to attributes b and c and respective indexes on attributes b and c.
- a third filtering relation FR T is shown with respect to an attribute d and an index on attribute d.
- R i ⁇ 1 , R i+1 , R i+2 , . . . , and R n are checked. This is because in checking the filtering relations, the terms in Category 3 are ignored and, hence, we may have false negatives.
- the content-based method in accordance with the present principles only cares whether the join result set J S is empty.
- two optimizations may be used to reduce the join overhead. In a first optional optimization, some attributes are projected out immediately after they are no longer needed.
- the pre-specified threshold may be, but is not limited to, about 5%. However, as is readily appreciated by one of ordinary skill in this and related arts, the exact percent is dependent upon the base relation size, the materialized view definition, and so forth and, thus varies from case to case.
- the terms in Category 3 are not considered in filtering relations and, thus, get ignored in the filtering process. Usually, using the terms in Categories 1 and 2 is sufficient to filter out most of the irrelevant updates.
- enhancements may be performed.
- some enhancements that may be performed for some embodiments include: compressing filtering relations; reducing the number of filtering relations; relaxing the equi-join condition of category 1; filtering out the irrelevant portion of an update; sharing a filtering relation among multiple join views; selectively skipping Operation O 3 ; using information about (intermediate) join results in Operation O 3 ; and load shedding.
- These enhancements may be used to enhance the compactness, efficiency, and functionality of filtering relations. It is to be appreciated that one or more of the enhancements may be utilized for a given embodiment in accordance with the present principles.
- joins are based on key/foreign key attributes and the values of these attributes are usually long strings (e.g., ids). Therefore, hashing can often reduce the sizes of filtering relations significantly.
- a hash function H (or multiple hash functions) has been applied to the filtering relation FR i of base relation R i (1 ⁇ i ⁇ n).
- the hash function H is first applied to the corresponding join attributes of the updated tuples ⁇ R i . Then ⁇ R i is joined with the filtering relations FR 1 , FR 2 , . . . , FR i ⁇ 1 . FR i+ 1, FR i+2 , . . . and FR n .
- base relation R i (1 ⁇ i ⁇ n) is small enough to be cached in memory in most cases. Also, no hash function has been applied to the corresponding filtering relation FR i . Then there is no need to keep FR i . Rather, in Operation O 3 , when we check filtering relations for irrelevant updates to some other base relation R j (1 ⁇ j ⁇ n, j ⁇ i), we use base relation R i and filtering relation FR k 's (1 ⁇ k ⁇ n, k ⁇ i, k ⁇ j). We may build some indices on the join attributes of R i . This can save the maintenance overhead of FR i when R i is updated.
- our content-based method keeps attributes (a i r.1 ,a i r.2 , . . . , a i r. ) in the filtering relation FR j of R j , and attributes (b i r.1 ,b i r.2 , . . . , b i r. ) in the filtering relation FR k of R k . Also, in checking filtering relations for irrelevant updates, our content-based method considers the equi-join conditions on two base relations that are of disjunctive-conjunctive form.
- ⁇ R i includes multiple tuples, then some tuples may be irrelevant while others may be relevant. In this case, treating the entire ⁇ R i as an entity may be too coarse. Another method is to treat each individual tuple in ⁇ R i as an entity. In Operation O 3 , the irrelevant tuples in ⁇ R i are filtered out. Then the remaining tuples in ⁇ R i are passed to Operation O 4 .
- a method for filtering out the irrelevant portion of an update to a materialized view MV is indicated generally by the reference numeral 600 .
- the method 600 suppose ⁇ R i contains q tuples t i (1 ⁇ i ⁇ q).
- the number i is appended as an additional attribute a a to tuple t i (step 605 ).
- ⁇ R i is joined with the filtering relations FR 1 , FR 2 , . . . , FR i ⁇ 1 , FR i+1 , FR i+2 , . . .
- a a is never projected out (step 610 ).
- S j ⁇
- attribute a a is extracted from S j (step 620 ). Otherwise, the update ⁇ R i is indicated as being irrelevant (step 625 ).
- duplicate elimination step 630
- the values of a a represent the remaining tuples in ⁇ R i that need to be passed to Operation O 4 (step 635 ).
- join view JV1 is defined as follows:
- C 1 is a selection condition on S.f. Join view JV 2 is defined as follows:
- C 2 is a selection condition on S.c.
- FRs can be used for both JV 1 and JV 2 . Whether FR S is better than FR S1 and FR S2 depends on the overlapping degree of C 1 and C 2 .
- Base relation S is built on filtering relations FR S , FR S1 , and FR S2 , and involves attributes c, b, and f.
- the “small percentage” of the update ⁇ R i to base relation R i that is irrelevant may be, but is not limited to, about 0.5%.
- the exact percent is dependent upon the base relation size, the materialized view definition, and so forth and, thus varies from case to case.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
There are provided a method, a computer program product, and a system for maintaining a materialized view defined on a relation of a relational database. The method includes the step of performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
Description
- 1. Technical Field
- The present invention relates generally to relational databases and, more particularly, to a system and method for real-time materialized view maintenance for relational databases.
- 2. Description of the Related Art
- Recently, there has been a growing trend to use data warehouses to make real-time decisions about a corporation's day-to-day operations. Most major relational database management system (RDBMS) vendors have spent great efforts on real-time data warehousing, including IBM's business intelligence, MICROSOFT's digital nervous system, ORACLE's Oracle10g, NCR's active data warehouse, and COMPAQ's zero-latency enterprise.
- A real-time data warehouse needs to handle real-time, online updates in addition to the traditional data warehouse query workload. This raises a problem that is present to a lesser degree in traditional data warehouses, namely when a base relation is updated, maintaining the materialized view(s) defined on it can bring a heavy burden to the corresponding RDBMS.
- To mitigate this problem, several methods have been proposed to detect irrelevant updates to a base relation R that do not affect the materialized view MV defined on R. For example, see the following, which are each incorporated by reference herein: Blakeley et al, “Updating Derived Relations: Detecting Irrelevant and Autonomously Computable Updates”, ACM Transactions on Database Systems (TODS), 1989, 14(3), pp. 369-400; Blakeley et al., “Efficiently Updating Materialized Views”, ACM International Conference on Management of Data (SIGMOD), 1986, pp. 61-71; and Levy et al., “Queries Independent of Updates”, International Conference on Very Large Data Bases (VLDB), 1993, pp. 171-181. However, all of these methods are “content-independent” in the sense that they only consider the “where” clause condition in a materialized view's definition while ignoring the content in the other base relations of the materialized view. As a result, these methods make over-conservative decisions and miss a large number of filtering opportunities.
- For example, consider the following materialized view MV:
- create materialized view MV as
- select * from R, S, T
- where R.a=S.b and S.c=T.d
- and R.e>20 and S.f=“xyz” and T.g=50;
- Assume that a materialized view MV records anomaly exists so that very few tuples in R, S, and T satisfy the where clause condition (R.a=S.b and S.c=T.d and R.e>20 and S.f=“xyz” and T.g=50) in the MV's definition. Suppose a tuple tR whose tR.e=30 is inserted into base relation R. Since tR.e>20, the existing prior art methods in the above-referenced articles cannot tell whether or not the MV will change. Therefore, the standard materialized view maintenance method has to be used, as follows. S is checked for a matching tuple(s) tS such that tS.b=tR.a and ts.f=“xyz”. If such a matching tuple ts exists, then T is further checked for matching tuple(s) tT such that tT.d=tS.c and tT.g=50. If both S and T are large and cannot be cached in memory, then such checking can incur a large number of input and output operations and become fairly expensive. However, because of the MV records anomaly, it is most likely that the insertion of tR into R will not affect the MV and, thus, all of the expensive checking is wasted.
- These and other drawbacks and disadvantages of the prior art are addressed by the present principles, which are directed to a system and method for real-time materialized view maintenance.
- According to an aspect of the present invention, there is provided a method for maintaining a materialized view defined on a relation of a relational database. The method includes the step of performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
- According to another aspect of the present invention, there is provided a computer program product including a computer usable medium having computer usable program code for maintaining a materialized view defined on a relation of a relational database. The computer program product includes computer usable program code for performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
- According to yet another aspect of the present invention, there is provided a system for maintaining a materialized view defined on a relation of a relational database. The system includes a materialized view manager for performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
- These and other objects, features and advantages will become apparent from the following detailed description of illustrative embodiments thereof, which is to be read in connection with the accompanying drawings.
- The disclosure will provide details in the following description of preferred embodiments with reference to the following figures wherein:
-
FIG. 1 is a block diagram illustrating an exemplary networked environment to which the present principles may be applied, according to an embodiment thereof; -
FIG. 2 is a block diagram illustrating an exemplary computing device to which the present principles may be applied, according to an embodiment thereof; -
FIG. 3 is a flow diagram for an exemplary method for maintaining a materialized view defined on a relation of a relational database, according to an embodiment of the present principles; -
FIG. 4 is a flow diagram for another exemplary method for maintaining a materialized view defined on a relation of a relational database, according to an embodiment of the present principles; -
FIG. 5 is a diagram for three exemplary filtering relations, according to an embodiment of the present principles; -
FIG. 6 is a flow diagram for a method for filtering out the irrelevant portion of an update to a materialized view MV, according to an embodiment of the present principles; and -
FIG. 7 is a diagram for an exemplary base relation S to which the present invention may be applied, according to an embodiment thereof. - Embodiments of the present principles are directed to a system and method for real-time materialized view maintenance. Advantageously, embodiments of the present principles may be used to identify irrelevant updates to a relation (a base relation or a derived relation) with respect to a materialized view defined on that relation. The irrelevant updates are identified more accurately and efficiently as compared to prior art approaches for performing the same.
- It should be understood that the elements shown in the FIGURES may be implemented in various forms of hardware, software or combinations thereof. Preferably, these elements are implemented in software on one or more appropriately programmed general-purpose digital computers having a processor and memory and input/output interfaces.
- Embodiments of the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment including both hardware and software elements. In a preferred embodiment, the present invention is implemented in software, which includes but is not limited to firmware, resident software, microcode, etc.
- Furthermore, the invention can take the form of a computer program product accessible from a computer-usable or computer-readable medium providing program code for use by or in connection with a computer or any instruction execution system. For the purposes of this description, a computer-usable or computer readable medium can be any apparatus that may include, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The medium can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) or a propagation medium. Examples of a computer-readable medium include a semiconductor or solid state memory, magnetic tape, a removable computer diskette, a random access memory (RAM), a read-only memory (ROM), a rigid magnetic disk and an optical disk. Current examples of optical disks include compact disk-read only memory (CD-ROM), compact disk-read/write (CD-R/W) and DVD.
- A data processing system suitable for storing and/or executing program code may include at least one processor coupled directly or indirectly to memory elements through a system bus. The memory elements can include local memory employed during actual execution of the program code, bulk storage, and cache memories which provide temporary storage of at least some program code to reduce the number of times code is retrieved from bulk storage during execution. Input/output or I/O devices (including but not limited to keyboards, displays, pointing devices, etc.) may be coupled to the system either directly or through intervening I/O controllers.
- Network adapters may also be coupled to the system to enable the data processing system to become coupled to other data processing systems or remote printers or storage devices through intervening private or public networks. Modems, cable modem and Ethernet cards are just a few of the currently available types of network adapters.
- Referring now to the drawings in which like numerals represent the same or similar elements and initially to
FIG. 1 , an exemplary networked environment to which the present principles may be applied, is indicated generally by thereference numeral 100. Theenvironment 100 includes one ormore client devices 110 connected to aserver 120 via anetwork 130. Thenetwork 130 may include wired and/or wireless links. Theserver 120 may be connected in signal communication with one ormore resources 140. Theresources 140 may include one or more local and/or remote sources. Theresources 140 may be connected to theserver 120 directly and/or via, e.g., one or more networks 140 (including wired and/or wireless links). Each of theclient devices 110 may include a materialized view maintenance system 199 (also referred to herein as “materialized view manager”) for maintaining a materialized view as described herein. - Turning to
FIG. 2 , an exemplary computing device to which the present principles may be applied is indicated generally by thereference numeral 200. It is to be appreciated that elements of thecomputing device 200 may be employed in any of theclient devices 110, theserver 120, and/or theresources 140. Moreover, it is to be further appreciated that elements of thecomputing device 200 may be employed in the materializedview maintenance system 199. - The
computing device 200 includes at least one processor (CPU) 202 operatively coupled to other components via asystem bus 204. A read only memory (ROM) 206, a random access memory (RAM) 208, adisplay adapter 210, an I/O adapter 212, auser interface adapter 214, asound adapter 299, and anetwork adapter 298, are operatively coupled to thesystem bus 204. - A
display device 216 is operatively coupled tosystem bus 204 bydisplay adapter 210. A disk storage device (e.g., a magnetic or optical disk storage device) 218 is operatively coupled tosystem bus 204 by I/O adapter 212. - A
mouse 220 andkeyboard 222 are operatively coupled tosystem bus 204 byuser interface adapter 214. Themouse 220 andkeyboard 222 are used to input and output information to and fromsystem 200. - At least one speaker (herein after “speaker”) 297 is operatively coupled to
system bus 204 bysound adapter 299. A (digital and/or analog)modem 296 is operatively coupled tosystem bus 204 bynetwork adapter 298. - To address the above-mentioned problems of the prior art approaches to maintaining a materialized view on a relation of a relational database, we introduce content-based filtering into materialized view maintenance. In one embodiment, up to four illustrative requirements may be utilized for efficient filtering to identify irrelevant updates to base relations of a materialized view. In an embodiment, we design “filtering relations” that summarize the most relevant information in the base relations and fulfill pre-specified requirements such as, but not limited to, the four illustrative requirements described herein. These filtering relations capture the relationship among multiple join attributes and can be efficiently maintained in real time. Upon an update ΔR to a base relation R that has a materialized view MV defined on it, the RDBMS uses the corresponding filtering relations of the other base relations of the MV to determine whether or not ΔR is irrelevant. The checking of filtering relations is usually significantly faster than checking base relations. Also, compared to the where clause condition in the MV's definition, filtering relations can provide more precise information about whether or not ΔR is irrelevant. In this way, the RDBMS can quickly and more precisely detect irrelevant updates to R and hence reduce the materialized view maintenance overhead.
- In an embodiment, one or more of the following four illustrative requirements may be used to design effective summary data structures: compactness; association; a high filtering ratio; and easy maintenance. As noted above, the present invention is not limited to only these four illustrative requirements and, given the teachings of the present invention provided herein, one of ordinary skill in this and related arts will contemplate these and various other requirements for implementing content-based filtering for materialized view maintenance, while maintaining the scope of the present invention. Moreover, different implementations of any of these same four requirements may also be implemented in accordance with the present principles, while maintaining the scope of the present principles.
- Consider a base relation R that has a join view JV defined on it. Our goal is to quickly filter out most of the irrelevant updates to R. This filtering process allows false negatives for irrelevant updates but not false positives. In other words, for any update ΔR to R, this filtering process may include the following characteristics.
- For example, in one characteristic, if our method says that ΔR is irrelevant, then it must be true that ΔR is irrelevant.
- In another characteristic, in the case that ΔR is irrelevant, with high probability p, our method can determine that ΔR is irrelevant; with low probability 1-p, our method indicates that it does not know whether ΔR is irrelevant.
- In yet another characteristic, in the case that ΔR is relevant, our method indicates that it does not know whether ΔR is irrelevant.
- As noted above, it is preferable to use one or more (and preferably, although not necessarily, all) of the following requirements to design effective summary data structures: compactness; association; a high filtering ratio; and easy maintenance.
- Regarding compactness, the summary data structures are preferably small as they are likely to be cached in memory. Thus, compactness can be an issue in achieving real-time results.
- Regarding association, the summary data structures preferably capture the relationship among multiple join attributes of a base relation. That is, given a join attribute value (e.g., S.b of the MV in the introduction), we can use the join attribute value to find the associated values of other join attributes (e.g., S.c).
- Regarding the high filtering ratio, the summary data structures can preferably quickly and correctly filter out most (or all) of the irrelevant updates to the base relations of a join view.
- Regarding easy maintenance, upon updates to the base relations, the summary data structures are preferably efficiently maintained in real time.
- There are several existing summary data structures (e.g., bloom filters, multi-attribute B-tree indices, and so forth). However, none of the existing summary data structures satisfies all of the above four properties nor is otherwise suitable for our filtering purposes.
- In the following, we first give an overview of our content-based detection method for irrelevant updates. Thereafter, a more detailed description of the content-based detection method is provided.
- Consider a join view JV that is defined on base relations R1, R2, . . . , and Rn (n≧2). For each Ri (1≦i≦n), we create a filtering relation FRi that summarizes the most relevant information in Ri. Upon an update ΔRi to a base relation Ri (1≦i≦n) of JV, our content-based method performs the following operations.
- Operation O1: Update the filtering relation FRi accordingly.
- Operation O2: To detect whether or not ΔRi is irrelevant, use the where clause condition in the JV's definition and techniques such as, but not limited to, those described by the following, which are each incorporated by reference herein: Blakeley et al, “Updating Derived Relations: Detecting Irrelevant and Autonomously Computable Updates”, TODS 14(3): 369-400, 1989; Blakeley et al., “Efficiently Updating Materialized Views”, SIGMOD Conf. 1986: 61-71; and Levy et al., “Queries Independent of Updates”, VLDB 1993: 171-181.
- Operation O3: If Operation O2 cannot tell that ΔRi is irrelevant, then check the filtering relations FR1, FR2, . . . FRi−1, FRi+1, FRi+2, . . . , and FRn to determine whether or not ΔRi is irrelevant.
- Operation O4: If Operation O3 cannot tell that ΔRi is irrelevant, then check base relations R1, R2, . . . , Ri−2, Ri+1, Ri+2, . . . , and R1 to determine exactly whether or not ΔRi is irrelevant. In the case that ΔRi is relevant, the JV is refreshed. Operation O4 is the standard join view maintenance method.
- Turning to
FIG. 3 , a method for maintaining a materialized view defined on a relation of a relational database is indicated generally by thereference numeral 300. It is to be appreciated that the relation may be a base relation or a derived relation (i.e., a relation derived from a base or other relation). It is to be further appreciated that the method ofFIG. 3 is described particularly with respect to Operation O1 and Operation O3 above, which illustrate operations performed in accordance with embodiments of the present principles. - Create one or more filtering relation data structures based on one or more pre-specified requirements (step 305). Optionally, the filtering relation data structure(s) may be created at
step 305 to be capable of being shared among multiple materialized views. - Update the filtering relation data structure(s) (e.g., per Operation O1 described herein) (step 306).
- Compress, reduce the number of, and/or otherwise modify the filtering relation data structure(s) (step 307). Step 307 may be performed, e.g., to enhance a result of the content-based filtering performed at
step 310, as described in further detail herein below. - Perform content-based filtering on the relation, using the filtering relation data structure(s), to identify an update to the relation as being irrelevant with respect to the materialized view (e.g., per Operation O3 described herein) (step 310).
- Estimate the importance and/or an effect(s) of the update to the relation (step 315).
- Perform a load shedding operation on the relational database based upon a result of the estimate performed at step 315 (step 320).
- Quantify the effect of the update being omitted from the materialized view based upon a result of the estimate performed at step 315 (step 325).
- Localize the effect of the update on the materialized view (step 330).
- Collapse multiple updates to the relation into a single transaction (combined update) to obtain a benefit such as, but not limited to, improving filtering efficiency (step 335). Thus, if the update under consideration can be combined with other corresponding updates to the base relation into a single transaction, then increased efficiency can likely be obtained.
- The update that is identified as being irrelevant or a portion thereof identified as being irrelevant is filtered out or otherwise omitted from the materialized view (step 340).
- It is to be appreciated that
steps steps - It is to be further appreciated that while in some embodiments, the present principles may be combined with one or more prior art steps and/or approaches for maintaining materialized views, any such steps and/or approaches of the prior art are omitted from
FIG. 3 for the sake of brevity. - Turning to
FIG. 4 , another method for maintaining a materialized view defined on a relation of a relational database is indicated generally by thereference numeral 400. It is to be appreciated that the relation may be a base relation or a derived relation (i.e., a relation derived from a base or other relation). It is to be further appreciated that the method ofFIG. 4 is described to illustrate a particular embodiment that involves the present principles (e.g., Operations O1 and O3) and, optionally, various aspects of the prior art (e.g., Operations O2 and O4). - Update the filtering relation(s) (e.g., per Operation O1 described herein) (step 405).
- Use the where clause condition in the join view's definition to determine whether or not ΔRi is irrelevant (e.g., per Operation O2 described herein) (step 410).
- It is then determined whether or not ΔRi has been deemed irrelevant, based on the where clause (step 415). If so, then the method is terminated.
- Otherwise, check the filtering relation(s) to determine whether or not ΔRi is irrelevant (e.g., per Operation O3 described herein) (step 420). It is then determined whether or not ΔRi has been deemed irrelevant, based on the checked filtering relations (step 425). If so, then the method is terminated. Otherwise, check the base relations to determine whether or not ΔRi is irrelevant (e.g., per Operation O4 described herein) (step 430).
- A description will now be given regarding a method implementing the present principles, according to an embodiment of the present principles.
- Suppose that Cw is the where clause condition in the definition of the join view JV. Cw is rewritten into a conjunction of m terms ci (1≦i≦m). Each term ci belongs to one of the following three categories:
- Category 1: For each i (1≦i≦m1), ci is a conjunctive equi-join condition on two base relations Rj and Rk (1≦j<k≦n). That is, ci is of the conjunctive form Rj.a1=Rk.b1 Rj.a2=Rk.b2 . . . Rj.ah=Rk.bh (h≧1). For different i's (1≦i≦m1), either the corresponding j's or the corresponding k's are different.
- Category 2: For each i (m1+1≦i≦m2), ci is a selection condition on a single base relation Rj (1≦j≦n). For different i's (m1+1≦i≦m2), the corresponding j's are different.
- Category 3: For each i (m2+1≦i≦m), ci is neither a conjunctive equi-join condition on two base relations nor a selection condition on a single base relation.
- For example, consider the join view MV mentioned above. The where clause condition in the MV's definition is a conjunction of five terms. The first two terms (R.a=S.b and S.c=T.d) belong to Category 1. The other three terms (R.e>20, S.f=“xyz”, and T.g=50) belong to Category 2. An example term of Category 3 is R.x+S.y>T.z, which does not appear in the where clause condition of the MV's definition.
- For each base relation Ri (1≦i≦n), we create a filtering relation FRi=πD(σc(Ri)). The projection list D includes all join attributes of Ri that appear in some term of Category 1. That is, for each term cj (1≦j≦m1) that is of the form Ri.a1=Rk.b1 Ri.a2=Rk.b2 . . . Ri.ah=Rk.bh (1≦k≦n, k≠i, h≧1), attributes {a1, a2, . . . , ah}⊂D. Also, we build an index on attributes (a1, a2, . . . , ah) The selection condition C is the term of Category 2 that is on Ri. That is, for some j (m1+1≦j≦m2), if the term cj is a selection condition on Ri, then C=cj. Otherwise (i.e., if no such cj exists), we have C=true.
- For example, consider the join view MV mentioned above, which will now be described with respect to
FIG. 5 . Turning toFIG. 5 , three exemplary filtering relations are indicated generally by thereference numeral 500. A first filtering relation FRR is shown with respect to an attribute a and an index on attribute a. A second filtering relation FRS is shown with respect to attributes b and c and respective indexes on attributes b and c. A third filtering relation FRT is shown with respect to an attribute d and an index on attribute d. - In Operation O3, upon an update ΔRi to base relation Ri (1≦i≦n), the updated tuples in Ri are joined with the corresponding filtering relations of the other base relations of the JV (i.e., FR1, FR2, . . . , FRi−1, FRi+1, FRi+2, . . . , and FRn). If no join result tuple is generated, the content-based method in accordance with the present principles determines ΔRi to be irrelevant. Otherwise, the content-based method in accordance with the present principles does not know whether ΔRi is irrelevant unless the other base relations R1, R2, . . . , Ri−1, Ri+1, Ri+2, . . . , and Rn are checked. This is because in checking the filtering relations, the terms in Category 3 are ignored and, hence, we may have false negatives.
- When the updated tuples in Ri are joined with the filtering relations FR1, FR2, . . . , FRi−1, FRi+1, FRi+2, . . . , and FRn, in an embodiment, the content-based method in accordance with the present principles only cares whether the join result set JS is empty. Hence, during the join process, two optimizations may be used to reduce the join overhead. In a first optional optimization, some attributes are projected out immediately after they are no longer needed. In a second optional optimization, for certain filtering relations, if there are multiple matching tuples in the filtering relation for an input tuple, then our content-based method only finds the first matching tuple rather than all matching tuples. In other words, for each input tuple to such a filtering relation, our content-based method generates at most one join result tuple. These two optional optimizations essentially compute a subset SS of the projection of JS and ensure that SS=φJS=φ. The details of these two optimizations are straightforward and readily determined by one of ordinary skill in this and related art and are, thus, omitted here for the sake of brevity. However, two examples are provided herein after for illustrative purposes.
- Consider the join view MV mentioned in the introduction. To illustrate the first optimization, consider an update ΔR to base relation R. In this case, the content-based method in accordance with the present principles only joins πa(ΔR) with the filtering relation FRS. For the join result Jr=πa(ΔR) a=bFRS, attributes a and b are projected out before Jr is joined with FRT. If either Jr or πc(Jr) c=dFRT is empty, then the content-based method knows that ΔR is irrelevant. Actually in this case, the content-based method can catch all irrelevant updates to the base relations. Thus, if we ignore the overhead of the checking/updating filtering relations, the content-based method avoids all unnecessary join view maintenance overhead in the content-independent method of the prior art. The overhead of checking/updating filtering relations is often minor.
- To illustrate the second optimization, suppose tuple ts is inserted into S. In the filtering process, our content-based method joins tuple tS1=πb, c(tS) first with FRR, and then with FRT. When the content-based method searches in FRR, once the method finds the first tuple tR matching tS1, the method generates the join result tuple tj=πc(tR a=btS1), stops the search in FRR, and continues to do the join with FRT. This is because the attributes of FRR do not include the join attribute c with FRT. Therefore, from the perspective of determining whether the join result with FRT is empty, there is no need to obtain more tuples in FRR that match tS1. If no tuple in FRR is found to match tS1, then we know that tuple tS is irrelevant. Similarly, when the content-based method searches in FRT, once the method finds the first tuple matching tj, the method stops the search in FRT.
- In the traditional join view maintenance method, the work needed when base relation Ri (1≦i≦n) is updated is as follows:
update Ri; Operation O2; /* check where clause condition in JV definition */ If (Operation O2 fails) Operation O4; (expensive) /* maintain JV using base relations */ - When we say Operation O2 fails, we mean that Operation O2 cannot tell whether the update to Ri is irrelevant.
- For comparison, in our content-based detection method, the work needed when base relation Ri (1≦i≦n) is updated is as follows:
update Ri; Operation O1; (cheap) /* update FRi */ Operation O2; /* check where clause condition in JV definition */ If (Operation O2 fails) Operation O3; (cheap) /* check filtering relations */ If (Operation O3 fails) Operation O4; (expensive) /* maintain JV using base relations */ - Usually, due to selection and projection, filtering relations are much smaller than base relations and, thus, more likely to be cached in memory. In this case, checking filtering relations is much faster than checking base relations. If the percentage of the updates to the base relations that are irrelevant are greater than a pre-specified threshold, and using filtering relations can filter out most of the irrelevant updates, then the extra work of (cheap) Operations O1 and O3 is dominated by the work saved in the expensive Operation O4. As a result, the total join view maintenance overhead is greatly reduced. As an example for illustrative purposes, the pre-specified threshold may be, but is not limited to, about 5%. However, as is readily appreciated by one of ordinary skill in this and related arts, the exact percent is dependent upon the base relation size, the materialized view definition, and so forth and, thus varies from case to case.
- Note that in order to minimize the sizes of filtering relations (the compactness property), in an embodiment, the terms in Category 3 are not considered in filtering relations and, thus, get ignored in the filtering process. Usually, using the terms in Categories 1 and 2 is sufficient to filter out most of the irrelevant updates.
- In some embodiments of content-based filtering in accordance with the present principles, further enhancements may be performed. For example, some enhancements that may be performed for some embodiments include: compressing filtering relations; reducing the number of filtering relations; relaxing the equi-join condition of category 1; filtering out the irrelevant portion of an update; sharing a filtering relation among multiple join views; selectively skipping Operation O3; using information about (intermediate) join results in Operation O3; and load shedding. These enhancements may be used to enhance the compactness, efficiency, and functionality of filtering relations. It is to be appreciated that one or more of the enhancements may be utilized for a given embodiment in accordance with the present principles. These enhancements will be further described in detail herein after.
- An embodiment will now be described with respect to compressing filtering relations. The performance advantages of the content-based detection method in accordance with the present principles depend heavily on the sizes of filtering relations. The smaller the filtering relations, the more likely they can be cached in memory and, thus, the greater performance advantages of the content-based detection method. Therefore, it is beneficial to reduce the sizes of filtering relations.
- To achieve this size reduction goal, we use the following hashing method. For each term ci (1≦i≦m1) of Category 1 that is of the form Rj.a1=Rk.b1 Rj.a2=Rk.b2 . . . Rj.ah=Rk.bh(1≦j<k≦n, h≧1), if the representation of attributes (a1, a2, . . . , ah) is longer than that of an integer attribute, then we use a hash function H to map each (a1, a2, . . . , ah) into an integer. In the filtering relation FRj of base relation Rj, we store H(a1, a2, . . . , ah) rather than (a1, a2, . . . , ah). Also, in the filtering relation FRk of base relation Rk, we store H(b1, b2, . . . , bh) rather than (b1, b2, . . . , bh).
- In practice, a large number of joins are based on key/foreign key attributes and the values of these attributes are usually long strings (e.g., ids). Therefore, hashing can often reduce the sizes of filtering relations significantly.
- Suppose a hash function H (or multiple hash functions) has been applied to the filtering relation FRi of base relation Ri (1≦i≦n). Upon an update ΔRi to Ri, the hash function H is first applied to the corresponding join attributes of the updated tuples ΔRi. Then ΔRi is joined with the filtering relations FR1, FR2, . . . , FRi−1. FRi+1, FRi+2, . . . and FRn.
- In the above hashing method, due to hash conflicts, we may introduce false negatives in detecting irrelevant updates using filtering relations. However, typical modern computers can represent a large number of distinct integer values (e.g., a 32-bit computer can represent 232 distinct integer values). In practice, if a good hash function is used, the probability of having hash conflicts should be low. As a result, this hashing method should not introduce a large number of false negatives.
- An embodiment will now be described with respect to reducing the number of filtering relations. In practice, most updates occur to one (or a few) base relation. The other base relations are rarely updated. In this case, in an embodiment, our content-based method may only keep filtering relations for the rarely updated base relations. No filtering relation may be kept for the most frequently updated base relation. Then for the update to the mostly frequently updated base relation (i.e., for most updates to the base relations), the filtering relation maintenance overhead is avoided. As a tradeoff, when some rarely updated base relation is updated (i.e., for a few updates to the base relations), the content-based detection method is not preferred for use. Rather, we may use the standard join view maintenance method.
- Suppose base relation Ri (1≦i≦n) is small enough to be cached in memory in most cases. Also, no hash function has been applied to the corresponding filtering relation FRi. Then there is no need to keep FRi. Rather, in Operation O3, when we check filtering relations for irrelevant updates to some other base relation Rj (1≦j≦n, j≠i), we use base relation Ri and filtering relation FRk's (1≦k≦n, k≠i, k≠j). We may build some indices on the join attributes of Ri. This can save the maintenance overhead of FRi when Ri is updated.
- An embodiment will now be described with respect to relaxing the equi-join condition of Category 1. For each term of Category 1, in an embodiment, we restrict the equi-join condition on two base relations Rj and Rk (1≦j<k≦n) to be of conjunctive form. In another embodiment, this condition can be relaxed so that for each term of Category 1, the equi-join condition on Rj and Rk is of disjunctive-conjunctive form ( Rj.ai
r,s =Rk.bir,s ), where t≧1 and hr≧1 (1≦r≦t). Then for each r (1≦r≦t), our content-based method keeps attributes (air.1 ,air.2 , . . . , air. ) in the filtering relation FRj of Rj, and attributes (bir.1 ,bir.2 , . . . , bir. ) in the filtering relation FRk of Rk. Also, in checking filtering relations for irrelevant updates, our content-based method considers the equi-join conditions on two base relations that are of disjunctive-conjunctive form. - An embodiment will now be described with respect to filtering out the irrelevant portion of an update. In the basic algorithm, the entire update ΔRi to base relation Ri (1≦i≦n) is treated as an entity. That is, in Operation O3, ΔRi is first joined with the filtering relations FR1, FR2, . . . , FRi−1, FRi+1, FRi+2, . . . , and FRn. If the join result set is empty, then we know that ΔRi is irrelevant. Otherwise in Operation O4, the entire ΔRi is joined with the base relations R1, R2, . . . , Ri−1, Ri+1, Ri+2, . . . , and Rn.
- In general, if ΔRi includes multiple tuples, then some tuples may be irrelevant while others may be relevant. In this case, treating the entire ΔRi as an entity may be too coarse. Another method is to treat each individual tuple in ΔRi as an entity. In Operation O3, the irrelevant tuples in ΔRi are filtered out. Then the remaining tuples in ΔRi are passed to Operation O4.
- Turning to
FIG. 6 , a method for filtering out the irrelevant portion of an update to a materialized view MV is indicated generally by thereference numeral 600. In themethod 600, suppose ΔRi contains q tuples ti (1≦i≦q). In Operation O3, for each i (1≦i≦q), the number i is appended as an additional attribute aa to tuple ti (step 605). When ΔRi is joined with the filtering relations FR1, FR2, . . . , FRi−1, FRi+1, FRi+2, . . . , and FRn, aa is never projected out (step 610). After we obtain the join result set Sj fromstep 610, if Sj≠Ø (step 615), attribute aa is extracted from Sj (step 620). Otherwise, the update ΔRi is indicated as being irrelevant (step 625). Then after duplicate elimination (step 630), the values of aa represent the remaining tuples in ΔRi that need to be passed to Operation O4 (step 635). - An embodiment will now be described with respect to sharing a filtering relation among multiple join views.
- Suppose multiple join views are built on the same base relation R. A simple method is to build multiple filtering relations of R, one for each join view. In certain cases, this may introduce redundancy among these filtering relations and cause two problems. First, the probability that the filtering relations are cached in memory is decreased. As a result, Operation O3 becomes more expensive. Second, when R is updated, updating all the filtering relations of R will be costly.
- In this case, if possible, it may be better to let multiple join views share the same filtering relation of base relation R. For example, suppose join view JV1 is defined as follows:
- create materialized view JV1 as
- select * from R1, S, T1
- where R1.a=S.b and S.c=T1.d and C1.
- C1 is a selection condition on S.f. Join view JV2 is defined as follows:
- create materialized view JV2 as
- select * from R2, S, T2
- where R2.e=S.b and S.f=T2.g and C2.
- C2 is a selection condition on S.c. Then for base relation S, we may build only one filtering relation FRS=πb.c.f(σVC
1 vC2 (S)) rather than two filtering relations FRS=πb.c(σC1 (S)) and FRS2=πb.f(σC2 (S)). FRs can be used for both JV1 and JV2. Whether FRS is better than FRS1 and FRS2 depends on the overlapping degree of C1and C2. - Turning to
FIG. 7 , an exemplary base relation S to which the present invention may be applied is indicated generally by thereference numeral 700. Base relation S is built on filtering relations FRS, FRS1, and FRS2, and involves attributes c, b, and f. - An embodiment will now be described with respect to selectively skipping Operation O3. If either a small percentage of the update ΔRi to base relation Ri is irrelevant, or ΔRi is large enough so that hash/sort-merge join becomes the join method of choice for the join with some base relation Rj (1≦j≦n, j≠i), then the content-based method may perform worse than the traditional content-independent method of the prior art. In this case, Operation O3 can be skipped in the content-based method. This is equivalent to using the content-independent method plus updating the filtering relation FRi accordingly. We can easily build an analytical model that can provide a means to determine the upper bound on the size of ΔRi (or lower bound on the percentage of ΔRi that is irrelevant) where performing Operation O3 is beneficial. As an example for illustrative purposes, the “small percentage” of the update ΔRi to base relation Ri that is irrelevant may be, but is not limited to, about 0.5%. However, as is readily appreciated by one of ordinary skill in this and related arts, the exact percent is dependent upon the base relation size, the materialized view definition, and so forth and, thus varies from case to case.
- An embodiment will now be described with respect to using the information about (intermediate) join results in Operation O3. Recall that in Operation O3, ΔRi is joined with the filtering relations FR1, FR2, . . . , FRi−1, FRi+1, FRi+2, . . . , and FRn. As a result, we know the (intermediate) join result sizes. If these (intermediate) join result sizes are significantly different from original estimates, we know that the statistics in the database are imprecise.
- Then in Operation O4, when the remaining tuples in ΔRi (after filtering) are joined with the base relations R1, R2, . . . , Ri−1, Ri+1, Ri+2, . . . , and Rn, the information that is gained in Operation O3 may be used to choose a better query plan.
- For example, consider the join view mentioned in the introduction. The base relation R is updated by ΔR. Suppose that it is believed that each tuple in ΔR has only a few matching tuples in base relation S. As a result, in Operation O4, index nested loops is chosen as the join method for the join with S. However, from the information we gained in Operation O3, we know that each tuple in ΔR has a large number of matching tuples in the filtering relation FRS (and thus also a large number of matching tuples in S). Then in Operation O4, our content-based method may indicate to choose hash join as the join method for the join with S.
- An embodiment will now be described with respect to load shedding. Our content-based method can estimate the effect of an update to the base relation on the join view. If the RDBMS is overloaded, then such estimate can provide guidance to a load shedding algorithm. For example, we may ignore those “unimportant” updates to base relations during join view maintenance. Moreover, we may collapse multiple updates into a single transaction so that more efficient algorithms (such as hash/sort-merge join) can be used.
- Having described preferred embodiments of a system and method (which are intended to be illustrative and not limiting), it is noted that modifications and variations can be made by persons skilled in the art in light of the above teachings. It is therefore to be understood that changes may be made in the particular embodiments disclosed which are within the scope and spirit of the invention as outlined by the appended claims. Having thus described aspects of the invention, with the details and particularity required by the patent laws, what is claimed and desired protected by Letters Patent is set forth in the appended claims.
Claims (20)
1. A method for maintaining a materialized view defined on a relation of a relational database, the method comprising:
performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
2. The method of claim 1 , wherein said performing step utilizes at least one filtering relation data structure to perform the content-based filtering.
3. The method of claim 2 , wherein the at least one filtering relation data structure is capable of being shared among multiple materialized views.
4. The method of claim 1 , further comprising generating an estimate of at least one of an importance and an effect of the update to the relation.
5. The method of claim 4 , further comprising at least one of, performing a load shedding operation on the relational database based upon the estimate, and quantifying the effect of the update being omitted from the materialized view based upon the estimate.
6. The method of claim 1 , further comprising localizing an effect of the update on the materialized view.
7. The method of claim 1 , further comprising collapsing multiple updates to the relation to improve filtering efficiency.
8. A computer program product comprising a computer usable medium having computer usable program code for maintaining a materialized view defined on a relation of a relational database, said computer program product comprising:
computer usable program code for performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
9. The computer program product of claim 8 , wherein said computer usable program code for performing the content-based filtering utilizes at least one filtering relation data structure to perform the content-based filtering, and wherein the at least one filtering relation data structure is capable of being shared among multiple materialized views.
10. The computer program product of claim 8 , further comprising computer usable program code for generating an estimate of at least one of an importance and an effect of the update to the relation.
11. The computer program product of claim 10 , further comprising computer usable program code for at least one of, performing a load shedding operation on the relational database based upon the estimate, and quantifying the effect of the update being omitted from the materialized view based upon the estimate.
12. The computer program product of claim 8 , further comprising computer usable program code for localizing an effect of the update on the materialized view.
13. The computer program product of claim 8 , further comprising computer usable program code for collapsing multiple updates to the relation to improve filtering efficiency.
14. A system for maintaining a materialized view defined on a relation of a relational database, the system comprising:
a materialized view manager for performing content-based filtering on the relation to identify an update to the relation as being irrelevant with respect to the materialized view.
15. The system of claim 14 , wherein said materialized view manager utilizes at least one filtering relation data structure to perform the content-based filtering.
16. The system of claim 15 , wherein the at least one filtering relation data structure is capable of being shared among multiple materialized views.
17. The system of claim 14 , wherein said materialized view manager generates an estimate of at least one of an importance and an effect of the update to the relation.
18. The system of claim 17 , wherein said materialized view manager at least one of, performs a load shedding operation on the relational database based upon the estimate, and quantifies the effect of the update being omitted from the materialized view based upon the estimate.
19. The system of claim 14 , wherein said materialized view manager localizes an effect of the update on the materialized view.
20. The system of claim 14 , wherein said materialized view manager collapses multiple updates to the relation to improve filtering efficiency.
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US11/386,346 US20070226264A1 (en) | 2006-03-22 | 2006-03-22 | System and method for real-time materialized view maintenance |
US12/061,162 US9984119B2 (en) | 2006-03-22 | 2008-04-02 | System and method for real-time materialized view maintenance |
US15/935,836 US11113277B2 (en) | 2006-03-22 | 2018-03-26 | System and method for real-time materialized view maintenance |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US11/386,346 US20070226264A1 (en) | 2006-03-22 | 2006-03-22 | System and method for real-time materialized view maintenance |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US12/061,162 Continuation US9984119B2 (en) | 2006-03-22 | 2008-04-02 | System and method for real-time materialized view maintenance |
Publications (1)
Publication Number | Publication Date |
---|---|
US20070226264A1 true US20070226264A1 (en) | 2007-09-27 |
Family
ID=38534840
Family Applications (3)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US11/386,346 Abandoned US20070226264A1 (en) | 2006-03-22 | 2006-03-22 | System and method for real-time materialized view maintenance |
US12/061,162 Active 2031-06-27 US9984119B2 (en) | 2006-03-22 | 2008-04-02 | System and method for real-time materialized view maintenance |
US15/935,836 Active US11113277B2 (en) | 2006-03-22 | 2018-03-26 | System and method for real-time materialized view maintenance |
Family Applications After (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US12/061,162 Active 2031-06-27 US9984119B2 (en) | 2006-03-22 | 2008-04-02 | System and method for real-time materialized view maintenance |
US15/935,836 Active US11113277B2 (en) | 2006-03-22 | 2018-03-26 | System and method for real-time materialized view maintenance |
Country Status (1)
Country | Link |
---|---|
US (3) | US20070226264A1 (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7822712B1 (en) * | 2007-10-18 | 2010-10-26 | Google Inc. | Incremental data warehouse updating |
US8818944B2 (en) | 2011-06-30 | 2014-08-26 | Microsoft Corporation | Data change tracking and event notification |
US20210026847A1 (en) * | 2019-07-26 | 2021-01-28 | Oracle International Corporation | Automatic generation of materialized views |
US11016947B1 (en) * | 2016-12-20 | 2021-05-25 | Cloudera, Inc. | Apparatus and method for recommending and maintaining analytical views |
US20220391390A1 (en) * | 2020-03-13 | 2022-12-08 | Snowflake Inc. | System and method for disjunctive joins |
US12135719B2 (en) | 2022-08-10 | 2024-11-05 | Oracle International Corporation | Automatic partitioning of materialized views |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10346273B2 (en) * | 2017-09-22 | 2019-07-09 | Analog Devices Global Unlimited Company | Automated analog fault injection |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7016910B2 (en) * | 1999-12-30 | 2006-03-21 | Decode Genetics Ehf. | Indexing, rewriting and efficient querying of relations referencing semistructured data |
Family Cites Families (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH077422B2 (en) * | 1991-08-23 | 1995-01-30 | インターナショナル・ビジネス・マシーンズ・コーポレイション | Method and system for executing join in computer processing database system |
US6026390A (en) * | 1996-05-29 | 2000-02-15 | At&T Corp | Cost-based maintenance of materialized views |
US6134543A (en) * | 1998-07-02 | 2000-10-17 | Oracle Corporation | Incremental maintenance of materialized views containing one-to-one lossless joins |
FR2793356B1 (en) * | 1999-05-04 | 2001-08-10 | Sextant Avionique | DEVICE FOR DISTRIBUTING ELECTRICAL ENERGY BETWEEN A PLURALITY OF ELECTRONIC MODULES WITH POSSIBILITY OF LOAD |
US6484159B1 (en) * | 1999-05-20 | 2002-11-19 | At&T Corp. | Method and system for incremental database maintenance |
US6513033B1 (en) * | 1999-12-08 | 2003-01-28 | Philip Trauring | Collaborative updating of collection of reference materials |
US7092951B1 (en) * | 2001-07-06 | 2006-08-15 | Ncr Corporation | Auxiliary relation for materialized view |
US6865569B1 (en) * | 2001-08-22 | 2005-03-08 | Ncr Corporation | Determining materialized view coverage |
EA006045B1 (en) * | 2001-11-01 | 2005-08-25 | Верисайн, Инк. | Method and system for updating a remote database |
US6882993B1 (en) * | 2002-01-28 | 2005-04-19 | Oracle International Corporation | Incremental refresh of materialized views with joins and aggregates after arbitrary DML operations to multiple tables |
US7111020B1 (en) * | 2002-03-26 | 2006-09-19 | Oracle International Corporation | Incremental refresh of materialized views containing rank function, and rewrite of queries containing rank or rownumber or min/max aggregate functions using such a materialized view |
US7149737B1 (en) * | 2002-04-04 | 2006-12-12 | Ncr Corp. | Locking mechanism using a predefined lock for materialized views in a database system |
US6952692B1 (en) * | 2002-05-17 | 2005-10-04 | Ncr Corporation | Execution of requests in a parallel database system |
US7668885B2 (en) * | 2002-09-25 | 2010-02-23 | MindAgent, LLC | System for timely delivery of personalized aggregations of, including currently-generated, knowledge |
US7139783B2 (en) * | 2003-02-10 | 2006-11-21 | Netezza Corporation | Materialized view system and method |
US7769770B2 (en) * | 2004-07-14 | 2010-08-03 | Microsoft Corporation | Secondary index and indexed view maintenance for updates to complex types |
US20060047696A1 (en) * | 2004-08-24 | 2006-03-02 | Microsoft Corporation | Partially materialized views |
US20060242102A1 (en) * | 2005-04-21 | 2006-10-26 | Microsoft Corporation | Relaxation-based approach to automatic physical database tuning |
-
2006
- 2006-03-22 US US11/386,346 patent/US20070226264A1/en not_active Abandoned
-
2008
- 2008-04-02 US US12/061,162 patent/US9984119B2/en active Active
-
2018
- 2018-03-26 US US15/935,836 patent/US11113277B2/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7016910B2 (en) * | 1999-12-30 | 2006-03-21 | Decode Genetics Ehf. | Indexing, rewriting and efficient querying of relations referencing semistructured data |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7822712B1 (en) * | 2007-10-18 | 2010-10-26 | Google Inc. | Incremental data warehouse updating |
US8818944B2 (en) | 2011-06-30 | 2014-08-26 | Microsoft Corporation | Data change tracking and event notification |
US8972459B2 (en) | 2011-06-30 | 2015-03-03 | Microsoft Corporation | Data change tracking and event notification |
US11016947B1 (en) * | 2016-12-20 | 2021-05-25 | Cloudera, Inc. | Apparatus and method for recommending and maintaining analytical views |
US20210026847A1 (en) * | 2019-07-26 | 2021-01-28 | Oracle International Corporation | Automatic generation of materialized views |
US11615107B2 (en) * | 2019-07-26 | 2023-03-28 | Oracle International Corporation | Automatic generation of materialized views |
US20220391390A1 (en) * | 2020-03-13 | 2022-12-08 | Snowflake Inc. | System and method for disjunctive joins |
US11615086B2 (en) * | 2020-03-13 | 2023-03-28 | Snowflake Inc. | System and method for disjunctive joins |
US12135719B2 (en) | 2022-08-10 | 2024-11-05 | Oracle International Corporation | Automatic partitioning of materialized views |
Also Published As
Publication number | Publication date |
---|---|
US9984119B2 (en) | 2018-05-29 |
US11113277B2 (en) | 2021-09-07 |
US20080189241A1 (en) | 2008-08-07 |
US20180210915A1 (en) | 2018-07-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11113277B2 (en) | System and method for real-time materialized view maintenance | |
US6957225B1 (en) | Automatic discovery and use of column correlations in tables | |
US7676450B2 (en) | Null aware anti-join | |
US8103689B2 (en) | Rewrite of queries containing rank or rownumber or min/max aggregate functions using a materialized view | |
US6792420B2 (en) | Method, system, and program for optimizing the processing of queries involving set operators | |
US6199063B1 (en) | System and method for rewriting relational database queries | |
US20160350371A1 (en) | Optimizer statistics and cost model for in-memory tables | |
US8078652B2 (en) | Virtual columns | |
US6457020B1 (en) | Query optimization using a multi-layered object cache | |
US6353818B1 (en) | Plan-per-tuple optimizing of database queries with user-defined functions | |
US7275056B2 (en) | System and method for transforming queries using window aggregation | |
US6801903B2 (en) | Collecting statistics in a database system | |
US7987178B2 (en) | Automatically determining optimization frequencies of queries with parameter markers | |
US6615206B1 (en) | Techniques for eliminating database table joins based on a join index | |
US7702627B2 (en) | Efficient interaction among cost-based transformations | |
US20050038784A1 (en) | Method and mechanism for database partitioning | |
US20080281784A1 (en) | Query handling in databases with replicated data | |
US20080040334A1 (en) | Operation of Relational Database Optimizers by Inserting Redundant Sub-Queries in Complex Queries | |
US8046352B2 (en) | Expression replacement in virtual columns | |
US8001112B2 (en) | Using multidimensional access as surrogate for run-time hash table | |
US7542962B2 (en) | Information retrieval method for optimizing queries having maximum or minimum function aggregation predicates | |
US6438541B1 (en) | Method and article for processing queries that define outer joined views | |
US9177024B2 (en) | System, method, and computer-readable medium for optimizing database queries which use spools during query execution | |
US8150865B2 (en) | Techniques for coalescing subqueries | |
Luo et al. | Content-based filtering for efficient online materialized view maintenance |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
AS | Assignment |
Owner name: INTERNATIONAL BUSINESS MACHINES CORPORATION, NEW Y Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:LUO, GANG;YU, PHILIP SHI-LUNG;REEL/FRAME:017429/0249 Effective date: 20060316 |
|
STCB | Information on status: application discontinuation |
Free format text: ABANDONED -- FAILURE TO RESPOND TO AN OFFICE ACTION |