Using estimated cost to schedule an order for refreshing a set of materialized views (MVS)
First Claim
1. A method for refreshing materialized views comprising:
- storing a plurality of materialized views;
for each materialized view of said plurality of materialized views;
submitting to an optimizer at least one set of one or more refresh expressions for refreshing said each materialized view, wherein said at least one set of one or more refresh expressions refreshes said each materialized view according to a particular refresh technique, wherein each refresh expression of said at least one set of one or more refresh expressions is a DML statement; and
said optimizer generating, for each refresh expression of said at least one set of one or more refresh expressions;
a query execution plan and a query execution cost for executing said query execution plan;
wherein for at least one materialized view of said plurality of materialized views, submitting to said optimizer at least one set of one or more refresh expressions includes submitting a plurality of sets of one or more refresh expressions, each set of one or more refresh expressions of said plurality of sets of one or more refresh expressions refreshing said at least one materialized view according to a respective refresh technique, wherein the respective refresh technique of said each set of one or more refresh expressions is different than the respective refresh technique of any other set of one or more refresh expressions of said plurality of sets of one or more refresh expressions;
wherein said plurality of sets of one or more refresh expressions includes at least two different sets of one or more refresh expressions that refresh said at least one materialized view according to at least two different incremental refresh techniques;
based on the query execution costs estimated by said optimizer, estimating a cost of each of a plurality of schedules for refreshing the plurality of materialized views;
choosing a preferred schedule from the plurality of schedules based on the estimated costs of the plurality of schedules; and
refreshing the plurality of materialized views according to the preferred schedule;
wherein the method is performed by one or more computing devices.
1 Assignment
0 Petitions
Accused Products
Abstract
In an embodiment, estimated costs are used to pick the best refresh technique (e.g., method) for a given MV. In another embodiment, estimated costs are used to schedule the refresh of a set MVs in an order such that overall time to refresh is reduced, or in an order that uses the smallest overall time, for refreshing when compared to other alternative refresh schedules. In another embodiment, the estimated cost of refreshing each of a set of MVs is used to select the set of CPU resources to allocate to refreshing each MV. Based on the estimated costs, the allocation of CPU resources is chosen to be more optimal (e.g., use less CPU time) than other available sets of CPU resources. In an embodiment, when refreshing an MV, delayed index maintenance is chosen if a significant portion of the base table and/or the partitions of the table has changed.
-
Citations
38 Claims
-
1. A method for refreshing materialized views comprising:
-
storing a plurality of materialized views; for each materialized view of said plurality of materialized views; submitting to an optimizer at least one set of one or more refresh expressions for refreshing said each materialized view, wherein said at least one set of one or more refresh expressions refreshes said each materialized view according to a particular refresh technique, wherein each refresh expression of said at least one set of one or more refresh expressions is a DML statement; and said optimizer generating, for each refresh expression of said at least one set of one or more refresh expressions;
a query execution plan and a query execution cost for executing said query execution plan;wherein for at least one materialized view of said plurality of materialized views, submitting to said optimizer at least one set of one or more refresh expressions includes submitting a plurality of sets of one or more refresh expressions, each set of one or more refresh expressions of said plurality of sets of one or more refresh expressions refreshing said at least one materialized view according to a respective refresh technique, wherein the respective refresh technique of said each set of one or more refresh expressions is different than the respective refresh technique of any other set of one or more refresh expressions of said plurality of sets of one or more refresh expressions; wherein said plurality of sets of one or more refresh expressions includes at least two different sets of one or more refresh expressions that refresh said at least one materialized view according to at least two different incremental refresh techniques; based on the query execution costs estimated by said optimizer, estimating a cost of each of a plurality of schedules for refreshing the plurality of materialized views; choosing a preferred schedule from the plurality of schedules based on the estimated costs of the plurality of schedules; and refreshing the plurality of materialized views according to the preferred schedule; wherein the method is performed by one or more computing devices. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 33)
-
-
19. A machine-readable non-transitory storage medium storing one or more sequences of instructions, which when executed by one or more processors, cause the one or more processors to perform steps comprising:
-
storing a plurality of materialized views; for each materialized view of said plurality of materialized views; submitting to an optimizer at least one set of one or more refresh expressions for refreshing said each materialized view, wherein said at least one set of one or more refresh expressions refreshes said each materialized view according to a particular refresh technique, wherein each refresh expression of said at least one set of one or more refresh expressions is a DML statement; and said optimizer generating, for each refresh expression of said at least one set of one or more refresh expressions;
a query execution plan and a query execution cost for executing said query execution plan;wherein for at least one materialized view of said plurality of materialized views, submitting to said optimizer at least one set of one or more refresh expressions includes submitting a plurality of sets of one or more refresh expressions, each set of one or more refresh expressions of said plurality of sets of one or more refresh expressions refreshing said at least one materialized view according to a respective refresh technique, wherein the respective refresh technique of said each set of one or more refresh expressions is different than the respective refresh technique of any other set of one or more refresh expressions of said plurality of sets of one or more refresh expressions; wherein said plurality of sets of one or more refresh expressions includes at least two different sets of one or more refresh expressions that refresh said at least one materialized view according to at least two different incremental refresh techniques; based on the query execution costs estimated by said optimizer, estimating a cost of each of a plurality of schedules for refreshing the plurality of materialized views; choosing a preferred schedule from the plurality of schedules based on the estimated costs of the plurality of schedules; and refreshing the plurality of materialized views according to the preferred schedule. - View Dependent Claims (20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38)
-
Specification