IP Library Granted Patent US 8,140,521
Granted Patent B1
US 8,140,521 · App. 10/800,493 · Granted Mar 20, 2012

Performing SQL query optimization by simplifying sub-expressions

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 8,140,521
App. No.
10/800,493
Granted
Mar 20, 2012
Kind
B1
Abstract

A method, computer program, and database system are disclosed for processing a database query that includes one or more expressions. The method includes resolving columns in one or more of the expressions. Expression optimization is performed on one or more of the expressions. Afterward, further query optimization is performed.

Claims (97)

1. A method of processing a database query on a computer, the query including an expression, the method including:

the computer performing expression optimization on the expression;

the computer performing further query optimization to produce a result;

the computer saving the result in a machine memory;

the computer performing expression optimization before further query optimization; and

where the expression includes a sub-expression (“SE”), and where the expression optimization includes:

the computer representing the query as a tree structure;

the computer representing the expression in the tree structure as a parent node having a first child node and a second child node;

where the first child node represents the sub-expression;

where the second child node represents the portion of the expression that is not the sub-expression; and

where the parent node represents an operation between the first child node and the second child node;

the computer determining that the second child node represents the constant 0 and that the parent node represents an arithmetic operation selected from the group consisting of addition and subtraction; and

in response, the computer removing the parent node and its children from the tree structure and inserting the first child node in its place.

2. The method of claim 1 , where the query includes an assignment list clause and where one or more of the expressions are in the assignment list clause.

3. The method of claim 1 , where the query includes a WHERE clause, and where one or more of the expressions are in the WHERE clause.

4. The method of claim 1 , where further query optimization includes:

determining a satisfiability of the database query.

5. The method of claim 1 , where further query optimization includes:

determining a transitive closure of the database query.

6. The method of claim 1 , where further query optimization includes:

determining one or more plans for executing the query.

7. The method of claim 6 , where one of the one or more plans includes:

scanning a table to locate rows that satisfy one or more conditions; and

summing one or more columns in the rows that satisfy the one or more conditions.

8. The method of claim 1 , where further query optimization includes:

selecting an optimal plan from executing the database query.

9. The method of claim 1 , where further query optimization includes two or more optimizations selected from the group consisting of:

determining a satisfiability of the database query;

determining a transitive closure of the database query;

determining one or more plans for executing the query; and

selecting an optimal plan from executing the database query.

10. A computer program, stored on a tangible storage medium, for use in processing a database query, the query including an expression, the computer program including executable instructions that cause a computer to:

perform expression optimization on the expression;

perform further query optimization to produce a result;

save the result in a machine memory;

where the expression includes a sub-expression (“SE”), where expression optimization is performed before further query optimization, and where the computer program includes executable instructions that cause a computer to:

represent the query as a tree structure;

represent the expression in the tree structure as a parent node having a first child node and a second child node;

where the first child node represents the sub-expression;

where the second child node represents the portion of the expression that is not the sub-expression; and

where the parent node represents an operation between the first child node and the second child node;

determine that the second child node represents the constant 0 and that the parent node represents an arithmetic operation selected from the group consisting of addition and subtraction; and

in response, remove the parent node and its children from the tree structure and insert the first child node in its place.

11. The computer program of claim 10 , where the query includes an assignment list clause and where one or more of the expressions are in the assignment list clause.

12. The computer program of claim 10 , where the query includes a WHERE clause, and where one or more of the expressions are in the WHERE clause.

13. The computer program of claim 10 , where further query optimization includes:

determining a satisfiability of the database query.

14. The computer program of claim 10 , where further query optimization includes:

determining a transitive closure of the database query.

15. The computer program of claim 10 , where further query optimization includes:

determining one or more plans for executing the query.

16. The computer program of claim 15 , where one of the one or more plans includes:

scanning a table to locate rows that satisfy one or more conditions; and

summing one or more columns in the rows that satisfy the one or more conditions.

17. The computer program of claim 10 , where further query optimization includes:

selecting an optimal plan from executing the database query.

18. The computer program of claim 10 , where further query optimization includes two or more optimizations selected from the group consisting of:

determining a satisfiability of the database query;

determining a transitive closure of the database query;

determining one or more plans for executing the query; and

selecting an optimal plan from executing the database query.

19. A database system including:

a massively parallel processing system including:

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 data storage facilities each of the one or more CPUs providing access to one or more data storage facilities;

a computer program for execution on the massively parallel processing system for processing a database query, the query including an expression, the computer program including executable instructions that cause one or more of the CPUs to:

perform expression optimization on the expression;

perform further query optimization to produce a result;

save the result in a memory;

where the expression optimization is performed before the further query optimization; and

where the expression includes a sub-expression (“SE”), and where expression optimization includes:

representing the query as a tree structure;

representing the expression in the tree structure as a parent node having a first child node and a second child node;

where the first child node represents the sub-expression;

where the second child node represents the portion of the expression that is not the sub-expression; and

where the parent node represents an operation between the first child node and the second child node;

determining that the second child node represents the constant 0 and that the parent node represents an arithmetic operation selected from the group consisting of addition and subtraction; and

in response, removing the parent node and its children from the tree structure and inserting the first child node in its place.

20. The database system of claim 19 , where the query includes an assignment list clause and where one or more of the expressions are in the assignment list clause.

21. The database system of claim 19 , where the query includes a WHERE clause, and where one or more of the expressions are in the WHERE clause.

22. The database system of claim 19 , where further query optimization includes:

determining a satisfiability of the database query.

23. The database system of claim 19 , where further query optimization includes:

determining a transitive closure of the database query.

24. The database system of claim 19 , where further query optimization includes:

determining one or more plans for executing the query.

25. The database system of claim 24 , where one of the one or more plans includes:

scanning a table to locate rows that satisfy one or more conditions; and

summing one or more columns in the rows that satisfy the one or more conditions.

26. The database system of claim 19 , where further query optimization includes:

selecting an optimal plan from executing the database query.

27. The database system of claim 19 , where further query optimization includes two or more optimizations selected from the group consisting of:

determining a satisfiability of the database query;

determining a transitive closure of the database query;

determining one or more plans for executing the query; and

selecting an optimal plan from executing the database query.

Assignments (3)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 18, 2008
From: NCR CORPORATION
To: TERADATA US, INC.
Reel/Frame 020666/0438 →
CORRECTIVE ASSIGNMENT FROM 3-15-2004 REEL 015095 FRAME 0822-25 Recorded Oct 13, 2004
From: SHELDON, STEPHEN F; LOPES, ARTHUR VARGAS; AU, GRACE KWAN-ON; GHAZAL, AHMAD SAID
To: NCR CORPORATION
Reel/Frame 015877/0860 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 15, 2004
From: LOPES, ARHUR VARGAS; AU, GRACE KWAN-ON; GHAZAL, AHMAD SAID; SHELDON, STEPHEN FIFE
To: NCR CORPORATION
Reel/Frame 015095/0822 →