IP Library Granted Patent US 9,886,492
Granted Patent B2
US 9,886,492 · App. 11/281,527 · Granted Feb 6, 2018

Self-adjusting database-query optimizer

Inventor: Stephen Brobst (Henderson, NV)
Assignee: Teradata US, Inc.
G06F17/30595G06F17/30463G06F17/30474
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,886,492
App. No.
11/281,527
Granted
Feb 6, 2018
Kind
B2
Abstract

A database-management system (DBMS) initiates execution of an incoming database query according to an initial query-execution plan that identifies an expected path for execution. Then, at some point after execution of the query has begun, the DBMS concludes that execution has not proceeded along the expected path and, in response, chooses an alternative query-execution plan for continued execution of the query.

Claims (53)

1. A computer-implemented method for use in executing a query in a database system, the method comprising:

formulating an initial query-execution plan that identifies an expected path for execution of the query;

formulating, prior to an execution of said query according to said initial query-execution plan, an alternative query-execution plan for execution of the query, said alternative query-execution plan differing from the initial query-execution plan from a point that occurs after an intermediate checkpoint in the initial query-execution plan;

initiating the execution of the query according to said initial query-execution plan;

at said intermediate checkpoint in the initial query-execution plan:

concluding that an actual result obtained at the intermediate checkpoint in the initial query-execution plan does not match an expected result; and

in response, choosing said alternative query-execution plan for the execution of the query;

continuing the execution of the query according to said alternative query-execution plan from said point that occurs after said intermediate checkpoint; and

abandoning the execution of the query according to said initial query-execution plan from said point that occurs after said intermediate checkpoint.

2. The method of claim 1 , wherein concluding that the actual result does not match the expected result includes concluding that the actual result differs from the expected result by more than an amount equal to a predefined margin-of-error.

3. The method of claim 1 , wherein concluding that the actual result does not match the expected result includes concluding that the actual result differs from the expected result by more than an amount equal to one of at least two predefined margins-of-error.

4. The method of claim 3 , wherein choosing said alternative query-execution plan includes choosing one of at least two alternative query-execution plans, where each of the at least two alternative query-execution plans corresponds to one of the at least two predefined margins-of-error.

5. The method of claim 1 , wherein concluding that an actual result does not match an expected result includes concluding that an actual row count for a database table does not match an expected row count.

6. The method of claim 1 , further comprising:

concluding that an actual result obtained at a second intermediate checkpoint does not match an expected result for the second intermediate checkpoint; and

choosing another alternative query-execution plan for the execution of the query following a point after said second intermediate checkpoint.

7. A computer-implemented method for use in executing a query in a database system, the method comprising:

formulating an initial query-execution plan that identifies an expected path for execution of the query;

formulating, prior to an execution of said query according to said initial query-execution plan, an alternative query-execution plan for execution of the query;

initiating the execution of the query according to said initial query-execution plan;

and at some point after the execution of the query has begun:

concluding that an actual result obtained at a first intermediate checkpoint in the initial query-execution plan matches an expected result for the first intermediate checkpoint;

concluding that an actual result for a second intermediate checkpoint in the initial query-execution plan does not match an expected result for the second intermediate checkpoint; and

in response, choosing said alternative query-execution plan for the execution of the query;

continuing the execution of the query according to said alternative query-execution plan from a point that occurs after said second intermediate checkpoint; and

abandoning the execution of the query according to said initial query-execution plan from said point that occurs after said second intermediate checkpoint.

8. A tangible, non-transitory computer readable storage medium, having a computer program for use in executing a query in a database system, the program comprising computer-readable instructions that, when executed by a computer, cause the computer to:

formulate an initial query-execution plan that identifies an expected path for execution of the query;

formulate, prior to an execution of said query according to said initial query-execution plan, an alternative query-execution plan for execution of the query, said alternative-execution plan differing from the initial query-execution plan from a point that occurs after an intermediate checkpoint in the initial query-execution plan;

initiate the execution of the query according to said initial query-execution plan;

at said intermediate checkpoint in the initial query-execution plan:

conclude that an actual result obtained at the intermediate checkpoint in the initial query-execution plan does not match an expected result; and

in response, choose said alternative query-execution plan for the execution of the query;

continue the execution of the query according to said alternative query-execution plan from said point that occurs after said intermediate checkpoint; and

abandon the execution of the query according to said initial query-execution plan from said point that occurs after said intermediate checkpoint.

9. The tangible, non-transitory computer readable storage medium, having a computer program for use in executing a query in a database system in accordance with claim 8 , wherein, in concluding that the actual result does not match the expected result, the computer concludes that the actual result differs from the expected result by more than an amount equal to a predefined margin-of-error.

10. The tangible, non-transitory computer readable storage medium, having a computer program for use in executing a query in a database system in accordance with claim 8 , wherein, in concluding that the actual result does not match the expected result, the computer concludes that the actual result differs from the expected result by more than an amount equal to one of at least two predefined margins-of-error.

11. The tangible, non-transitory computer readable storage medium, having a computer program for use in executing a query in a database system in accordance with claim 10 , wherein, in choosing said alternative query-execution plan, the computer chooses one of at least two alternative query-execution plans, where each of the at least two alternative query-execution plans corresponds to one of the at least two predefined margins-of-error.

12. The tangible, non-transitory computer readable storage medium, having a computer program for use in executing a query in a database system in accordance with of claim 8 , wherein, in concluding that an actual result does not match an expected result, the computer concludes that an actual row count for a database table does not match an expected row count.

13. The tangible, non-transitory computer readable storage medium, having a computer program for use in executing a query in a database system in accordance with claim 8 , wherein the program also causes the computer to:

conclude that an actual result obtained at a second intermediate checkpoint does not match an expected result for the second intermediate checkpoint; and

choose another alternative query-execution plan for the execution of the query following a point after said second intermediate checkpoint.

14. A tangible, non-transitory computer readable storage medium, having a computer program for use in executing a query in a database system, the computer program including computer-readable instructions that, when executed by a computer, cause the computer to:

formulate an initial query-execution plan for execution of the query that includes an initial cost estimate indicating how one or more database resources are expected to be used in carrying out the initial query-execution plan;

formulate, prior to an execution of said query according to said initial query-execution plan, an alternative query-execution plan for execution of the query, said alternative-execution plan differing from the initial query-execution plan from a point that occurs after an intermediate checkpoint in the initial query-execution plan;

start the execution of the query according to the initial query-execution plan; and

at said intermediate checkpoint after the execution of the query according to the initial query-execution plan has started:

receive information about an actual result obtained during the execution of the query according to the initial query-execution plan;

use the actual result to calculate a revised cost estimate indicating how the one or more database resources are expected to be used in carrying out the initial query-execution plan from the intermediate checkpoint;

compare the revised cost estimate to the initial cost estimate;

conclude that the revised cost estimate lies beyond a predetermined margin-of-error around the initial cost estimate;

continue the execution of the query according to said alternative query-execution plan from said point that occurs after said intermediate checkpoint; and

abandon the execution of the query according to said initial query-execution plan from said point that occurs after said intermediate checkpoint.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 18, 2008
From: NCR CORPORATION
To: TERADATA US, INC.
Reel/Frame 020666/0438 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Nov 17, 2005
From: BROBST, STEPHEN
To: NCR CORPORATION
Reel/Frame 017231/0340 →
Continuity (3)
Continuation 11219250 · Sep 2, 2005
Continuation 11022376 · Dec 22, 2004
Related Publication 20060136396A1 · Jun 22, 2006