Claims
- 1. A method for maintaining pre-computed aggregate views, comprising:
receiving a pre-computed aggregate view derived from one or more base tables, the pre-computed aggregate view including a pre-computed aggregate table and a view definition, the view definition including aggregation functions that can be any combination of sum, sum distinct, count(*), count distinct, min, and max, the view definition further including expressions that may be nullable; receiving changes to the base table, the changes being non-minimal; defining a first table wherein each record shows, for an aggregation function, contributions from changes that are insertions and contributions from changes that are deletions; identifying in the first table each row representing an aggregated group that is not currently represented in the pre-computed aggregated table, that has more changes that are insertions than changes that are deletions, and that does not require recomputation; and modifying the pre-computed aggregate table with information from the identified rows.
- 2. The method of claim 1, wherein defining a first table includes:
representing changes as insertions and deletions when the changes are not already represented as insertions an deletions; tagging insertions and deletions with distinguishing literals; combining the tagged insertions and tagged deletions; and aggregating the tagged insertions and tagged deletions, wherein when the view definition does not include a count function, adding a count function to count the total number of changes that are insertions and the total number of changes that are deletions for each aggregated group of changes.
- 3. The method of claim 2, wherein the pre-computed aggregate table includes row identifiers, and wherein identifying rows includes:
performing an outer join of the first table and the pre-computed aggregate table, wherein the outer join results in a second table in which a row having a null as a row identifier represents an aggregated group not currently represented in the pre-computed aggregate table; and identifying, from the second table, each row that has a null value as a row identifier and that further has a greater count for changes that are insertions than a count for changes that are deletions.
- 4. The method of claim 1, wherein modifying includes:
constructing new rows from the identified rows; and inserting the new rows into the pre-computed aggregate table.
- 5. The method of claim 4, further comprising:
removing the identified rows from the first table.
- 6. The method of claim 5, further comprising:
when the view definition does not include a count distinct or a sum distinct, identifying, from the first table, rows that have corresponding rows in the pre-computed aggregate table and that further have aggregation values that can be determined without referring to the one or more base tables to accurately maintain the pre-computed aggregate view; updating the identified rows; and removing the identified rows from the first table.
- 7. The method of claim 6, further comprising:
when the view definition does include a count distinct or a sum distinct, deleting from the pre-computed aggregate table rows that have corresponding rows in the first table.
- 8. The method of claim 7, further comprising:
recomputing aggregate values for the first table; and inserting rows containing the recomputed aggregate values into the pre-computed aggregate table.
- 9. A computer program product, stored on a machine-readable medium, for incrementally maintaining pre-computed aggregate views, comprising instructions operable to cause a programmable processor to:
receive a pre-computed aggregate view derived from one or more base tables, the pre-computed aggregate view including a pre-computed aggregate table and a view definition, the view definition including aggregation functions that can be any combination of sum, sum distinct, count(*), count distinct, min, and max, the view definition further including expressions that may be nullable; receive changes to the base table, the changes being non-minimal; define a first table wherein each record shows, for an aggregation function, contributions from changes that are insertions and contributions from changes that are deletions; identify in the first table each row representing an aggregated group that is not currently represented in the pre-computed aggregated table, that has more changes that are insertions than changes that are deletions, and that does not require recomputation; and modify the pre-computed aggregate table with information from the identified rows.
- 10. The computer program product of claim 9, wherein defining a first table includes:
representing changes as insertions and deletions when the changes are not already represented as insertions an deletions; tagging insertions and deletions with distinguishing literals; combining the tagged insertions and tagged deletions; and aggregating the tagged insertions and tagged deletions, wherein when the view definition does not include a count function, adding a count function to count the total number of changes that are insertions and the total number of changes that are deletions for each aggregated group of changes.
- 11. The computer program product of claim 10, wherein the pre-computed aggregate table includes row identifiers, and wherein identifying rows includes:
performing an outerjoin of the first table and the pre-computed aggregate table, wherein the outer join results in a second table in which a row having a null as a row identifier represents an aggregated group not currently represented in the pre-computed aggregate table; and identifying, from the second table, each row that has a null value as a row identifier and that further has a greater count for changes that are insertions than a count for changes that are deletions.
- 12. The computer program product of claim 9, wherein modifying includes:
constructing new rows from the identified rows; and inserting the new rows into the pre-computed aggregate table.
- 13. The computer program product of claim 12, further comprising instructions to: remove the identified rows from the first table.
- 14. The computer program product of claim 13, further comprising instructions to:
when the view definition does not include a count distinct or a sum distinct, identify, from the first table, rows that have corresponding rows in the pre-computed aggregate table and that further have aggregation values that can be determined without referring to the one or more base tables to accurately maintain the pre-computed aggregate view; update the identified rows; and remove the identified rows from the first table.
- 15. The computer program product of claim 14, further comprising instructions to:
when the view definition does include a count distinct or a sum distinct, delete from the pre-computed aggregate table rows that have corresponding rows in the first table.
- 16. The computer program product of claim 15, further comprising instructions to:
recompute aggregate values for the first table; and insert rows containing the recomputed aggregate values into the pre-computed aggregate table.
- 17. A method for maintaining pre-computed aggregate views, comprising:
receiving a pre-computed aggregate view derived from one or more base tables, the pre-computed aggregate view including a pre-computed aggregate table and a view definition, the pre-computed aggregate view being self-maintainable; receiving changes to the base table, the changes being non-minimal; defining a first table wherein each record shows, for an aggregation function, contributions from changes that are insertions and contributions from changes that are deletions; identifying in the first table each row representing an aggregated group that is not currently represented in the pre-computed aggregated table and that has more changes that are insertions than changes that are deletions; and modifying the pre-computed aggregate table with information from the identified rows.
- 18. A computer program product, stored on a machine-readable medium, for incrementally maintaining pre-computed aggregate views, comprising instructions operable to cause a programmable processor to:
receive a pre-computed aggregate view derived from one or more base tables, the pre-computed aggregate view including a pre-computed aggregate table and a view definition, the pre-computed aggregate view being self-maintainable; receive changes to the base table, the changes being non-minimal; define a first table wherein each record shows, for an aggregation function, contributions from changes that are insertions and contributions from changes that are deletions; identify in the first table each row representing an aggregated group that is not currently represented in the pre-computed aggregated table, and that has more changes that are insertions than changes that are deletions; and modify the pre-computed aggregate table with information from the identified rows.
- 19. A method for maintaining pre-computed aggregate views, comprising:
receiving a pre-computed aggregate view derived from one or more base tables, the pre-computed aggregate view including a pre-computed aggregate table and a view definition, the view definition including aggregation functions that can be any combination of sum, sum distinct, count(*), count distinct, min, and max., the view definition may include expressions that may be nullable; receiving changes to the base table, the changes may be non-minimal; defining and applying a set of incremental modifications to the pre-computed aggregate table, wherein modifications may include any combination of inserts, deletes, and updates; defining a first table wherein each record, representing an aggregated group of changes, shows, for each aggregation function, the contributions of base table changes that are insertions for the group and the contributions of base table changes that are deletions for the group, each record in the first table further including the number of changes that are insertions and the number of changes that are deletions for the group represented by the record; defining the incremental modifications to the pre-computed aggregate table using some combination of information in the first table, the pre-computed aggregate table, and the one or more base tables from which the pre-computed view is derived; identifying rows in the first table that do not contribute to the incremental modifications; modifying the pre-computed aggregate table based only on information in the first table; modifying the pre-computed aggregate table based only on information in the first table and the pre-computed aggregate table; and analyzing the view definition, including the type of aggregation functions and the nullability and data type of columns and expressions in the view definition, to reduce or eliminate the use of information in base tables in order to define the incremental modifications to the pre-computed aggregate table.
- 20. A computer program product, stored on a machine-readable medium, for incrementally maintaining pre-computed aggregate views, comprising instructions operable to cause a programmable processor to:
receive a pre-computed aggregate view derived from one or more base tables, the pre-computed aggregate view including a pre-computed aggregate table and a view definition, the view definition including aggregation functions that can be any combination of sum, sum distinct, count(*), count distinct, min, and max., the view definition may include expressions that may be nullable; receive changes to the base table, the changes may be non-minimal; define and apply a set of incremental modifications to the pre-computed aggregate table, wherein modifications may include any combination of inserts, deletes, and updates; define a first table wherein each record, representing an aggregated group of changes, shows, for each aggregation function, the contributions of base table changes that are insertions for the group and the contributions of base table changes that are deletions for the group, each record in the first table further including the number of changes that are insertions and the number of changes that are deletions for the group represented by the record; define the incremental modifications to the pre-computed aggregate table using some combination of information in the first table, the pre-computed aggregate table, and the one or more base tables from which the pre-computed view is derived; identify rows in the first table that do not contribute to the incremental modifications; modify the pre-computed aggregate table based only on information in the first table; modify the pre-computed aggregate table based only on information in the first table and the pre-computed aggregate table; and analyze the view definition, including the type of aggregation functions and the nullability and data type of columns and expressions in the view definition, to reduce or eliminate the use of information in base tables in order to define the incremental modifications to the pre-computed aggregate table.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application claims benefit of U.S. Provisional Application No. 60/221,599, filed Jul. 28, 2000, which is incorporated herein by reference in its entirety.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60221599 |
Jul 2000 |
US |