Method and system for updating value correlation optimizations
First Claim
1. A method for executing database queries, the database comprising a first table (T1) having a primary key (PK) column and a first correlated value column (CV1) and a second table (T2) having a foreign key (FK) column related to the primary key column of the first table and a second correlated value column (CV2), comprising the steps of:
- preparing a database query for execution on a database comprising a first table (T1) having a primary key (PK) column and a first correlated value column (CV1) and a second table (T2) having a foreign key (FK) column related to the primary key column of the first table and a second correlated value column (CV2), said execution based at least in part on application of a derived constraint rule (DCR) having the following form;
(PK=FK)→
CV2+C1≦
CV1≦
CV2+C2where C1 and C2 are constants, and “
→
”
means “
implies,”
to produce an execution plan;
taking into account a frequency of errors due to changes in DCRs when preparing the execution plan, wherein taking into account the frequency of errors due to changes in DCRs when preparing the execution plan comprises determining that a higher cost execution plan that risks no errors due to changes in DCRs is preferable; and
executing the plan.
2 Assignments
0 Petitions
Accused Products
Abstract
A method, computer program, and database system are disclosed for executing database queries. The database includes a first table (T1) having a primary key (PK) column and a first correlated value column (CV1) and a second table (T2) having a foreign key (FK) column related to the primary key column of the first table and a second correlated value column (CV2). One implementation of the method includes preparing a database query for execution based at least in part on application of a derived constraint rule (DCR) having the form, (PK=FK)→CV2+C1≦CV1≦CV2+C2, where C1 and C2 are constants and “→” means “implies,” to produce an execution plan. A frequency of errors due to changes in DCRs is taken into account when preparing the execution plan. The plan is then executed.
75 Citations
9 Claims
-
1. A method for executing database queries, the database comprising a first table (T1) having a primary key (PK) column and a first correlated value column (CV1) and a second table (T2) having a foreign key (FK) column related to the primary key column of the first table and a second correlated value column (CV2), comprising the steps of:
-
preparing a database query for execution on a database comprising a first table (T1) having a primary key (PK) column and a first correlated value column (CV1) and a second table (T2) having a foreign key (FK) column related to the primary key column of the first table and a second correlated value column (CV2), said execution based at least in part on application of a derived constraint rule (DCR) having the following form;
(PK=FK)→
CV2+C1≦
CV1≦
CV2+C2where C1 and C2 are constants, and “
→
”
means “
implies,”
to produce an execution plan;taking into account a frequency of errors due to changes in DCRs when preparing the execution plan, wherein taking into account the frequency of errors due to changes in DCRs when preparing the execution plan comprises determining that a higher cost execution plan that risks no errors due to changes in DCRs is preferable; and executing the plan. - View Dependent Claims (2, 3)
-
-
4. A computer program, stored on a tangible storage medium, for executing database queries, the database comprising a first table (T1) having a primary key (PK) column and a first correlated value column (CV1) and a second table (T2) having a foreign key (FK) column related to the primary key column of the first table and a second correlated value column (CV2), the program comprising executable instructions that cause one or more computers to:
-
prepare a database query for execution on a database comprising a first table (T1) having a primary key (PK) column and a first correlated value column (CV1) and a second table (T2) having a foreign key (FK) column related to the primary key column of the first table and a second correlated value column (CV2), said execution based at least in part on application of a derived constraint rule (DCR) having the following form;
(PK=FK)→
CV2+C1≦
CV1<
CV2+C2where C1 and C2 are constants, and “
→
”
means “
implies,”
to produce an execution plan;take into account a frequency of execution errors due to changes in DCRs when preparing the execution plan, wherein when taking into account the frequency of errors due to changes in DCRs when preparing the execution plan, the executable instructions cause one or more computers to determine that a higher cost execution plan that risks no errors due to changes in DCRs is preferable; and execute the plan. - View Dependent Claims (5, 6)
-
-
7. A database system for executing database queries, comprising:
-
one or more nodes; a plurality of CPUs, each of the one or more nodes providing access to one or more CPUs; a plurality of virtual processes, each of the one or more CPUs providing access to one or more virtual processes; each virtual process configured to manage data, including rows organized in tables, stored in one of a plurality of data-storage facilities; a first table (T1) having a primary key (PK) column and a first correlated value column (CVO; a second table (T2) having a foreign key (FK) column related to the primary key column of the first table and a second correlated value column (CV2), and an optimizer configured to; prepare a database query for execution based at least in part on application of a derived constraint rule (DCR) having the following form;
(PK=FK)→
CV2+C1≦
CV1≦
CV2+C2where C1 and C2 are constants, and “
→
”
means “
implies,”
to produce an execution plan; andtake into account the frequency of execution errors due to changes in DCRs when preparing the execution plan, wherein when the optimizer takes into account the frequency of errors due to changes in DCRs when preparing the execution plan it determines that a higher cost execution plan that risks no errors due to changes in DCRs is preferable. - View Dependent Claims (8, 9)
-
Specification