IP Library Granted Patent US 7,890,491
Granted Patent B1
US 7,890,491 · App. 09/669,556 · Granted Feb 15, 2011

Query optimization technique for obtaining improved cardinality estimates using statistics on automatic summary tables

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 7,890,491
App. No.
09/669,556
Granted
Feb 15, 2011
Kind
B1
Abstract

A technique for optimizing execution of a query that accesses data stored on a data store connected to a computer. Statistics on one or more automatic summary tables are used to determine an optimal query execution plan for the query. In particular, improved cardinality estimates are generated for one or more query execution plans for the query using statistics of one or more automatic summary tables that vertically overlap the query. These cardinality estimates are used to make more accurate cost estimates, thus improving the likelihood of determining the optimal query execution plan.

Claims (38)

1. A method of optimizing execution of a query that accesses data stored on a data store connected to a computer, comprising:

generating cardinality estimates for one or more query execution plans for the query using statistics of one or more automatic summary tables that vertically overlap the query, wherein the statistics of the one or more automatic summary tables are used to improve a combined selectivity estimate of one or more predicates of the query, wherein the predicates are applied by one of the automatic summary tables, and wherein the selectivity estimate comprises a ratio of a cardinality of the automatic summary table to a product of cardinalities of base tables referenced in the automatic summary table and the query;

using the generated cardinality estimates to determine an optimal query execution plan for the query; and

executing the optimal query execution plan for the query in order to access the data stored on the data store connected to a computer and then output the accessed data.

2. A method of optimizing execution of a query that accesses data stored on a data store connected to a computer, comprising:

generating cardinality estimates for one or more query execution plans for the query using statistics of one or more automatic summary tables that vertically overlap the query, wherein the statistics of the one or more automatic summary tables are used to improve a combined selectivity estimate of one or more predicates of the query, wherein zero or more predicates of the query are applied by one of the automatic summary tables, and wherein the remaining predicates are eligible to be applied on the automatic summary table;

using the generated cardinality estimates to determine an optimal query execution plan for the query; and

executing the optimal query execution plan for the query in order to access the data stored on the data store connected to a computer and then output the accessed data.

3. The method of claim 2 , wherein a predicate is eligible to be applied on the automatic summary table if it can be evaluated using the output columns and expressions of the automatic summary table.

4. The method of claim 3 , further comprising determining a subpredicate combined selectivity estimate of the unapplied eligible predicates using column distribution statistics of the automatic summary table.

5. The method of claim 4 , wherein a cardinality ratio comprises a ratio of a cardinality of the automatic summary table to a product of cardinalities of base tables referenced in the automatic summary table and the query.

6. The method of claim 5 , wherein the selectivity estimate comprises a product of the subpredicate combined selectivity estimate and the cardinality ratio.

7. An apparatus for optimizing execution of a query, comprising:

a computer having a data store coupled thereto, wherein the data store stores data one or more computer programs, performed by the computer, for:

generating cardinality estimates for one or more query execution plans for the query using statistics of one or more automatic summary tables that vertically overlap the query, wherein the statistics of the one or more automatic summary tables are used to improve a combined selectivity estimate of one or more predicates of the query, wherein the predicates are applied by one of the automatic summary tables, and wherein the selectivity estimate comprises a ratio of a cardinality of the automatic summary table to a product of cardinalities of base tables referenced in the automatic summary table and the query;

using the generated cardinality estimates to determine an optimal query execution plan for the query; and

executing the optimal query execution plan for the query in order to access the data stored on the data store connected to a computer and then output the accessed data.

8. An apparatus for optimizing execution of a query, comprising:

a computer having a data store coupled thereto, wherein the data store stores data one or more computer programs, performed by the computer, for:

generating cardinality estimates for one or more query execution plans for the query using statistics of one or more automatic summary tables that vertically overlap the query, wherein the statistics of the one or more automatic summary tables are used to improve a combined selectivity estimate of one or more predicates of the query, wherein zero or more predicates of the query are applied by one of the automatic summary tables and wherein the remaining predicates are eligible to be applied on the automatic summary table;

using the generated cardinality estimates to determine an optimal query execution plan for the query; and

executing the optimal query execution plan for the query in order to access the data stored on the data store connected to a computer and then output the accessed data.

9. The apparatus of claim 8 , a predicate is eligible to be applied on the automatic summary table if it can be evaluated using the output columns and expressions of the automatic summary table.

10. The apparatus of claim 9 , further comprising determining a subpredicate combined selectivity estimate of the unapplied eligible predicates using column distribution statistics of the automatic summary table.

11. The apparatus of claim 10 , wherein a cardinality ratio comprises a ratio of a cardinality of the automatic summary table to a product of cardinalities of base tables referenced in the automatic summary table and the query.

12. The apparatus of claim 11 , wherein the selectivity estimate comprises a product of the subpredicate combined selectivity estimate and the cardinality ratio.

13. An article of manufacture comprising a non-transitory computer readable storage medium embodying one or more instructions executable by a computer to optimizing execution of a query that accesses data stored on a data store connected to the computer, comprising:

generating cardinality estimates for one or more query execution plans for the query using statistics of one or more automatic summary tables that vertically overlap the query, wherein the statistics of the one or more automatic summary tables are used to improve a combined selectivity estimate of one or more predicates of the query, wherein the predicates are applied by one of the automatic summary tables, and wherein the selectivity estimate comprises a ratio of a cardinality of the automatic summary table to a product of cardinalities of base tables referenced in the automatic summary table and the query;

using the generated cardinality estimates to determine an optimal query execution plan for the query; and

executing the optimal query execution plan for the query in order to access the data stored on the data store connected to a computer and then output the accessed data.

14. An article of manufacture comprising a non-transitory computer readable storage medium embodying one or more instructions executable by a computer to optimizing execution of a query that accesses data stored on a data store connected to the computer, comprising:

generating cardinality estimates for one or more query execution plans for the query using statistics of one or more automatic summary tables that vertically overlap the query, wherein the statistics of the one or more automatic summary tables are used to improve a combined selectivity estimate of one or more predicates of the query, wherein zero or more predicates of the query are applied by one of the automatic summary tables, and wherein the remaining predicates are eligible to be applied on the automatic summary table;

using the generated cardinality estimates to determine an optimal query execution plan for the query; and

executing the optimal query execution plan for the query in order to access the data stored on the data store connected to a computer and then output the accessed data.

15. The article of manufacture of claim 14 , a predicate is eligible to be applied on the automatic summary table if it can be evaluated using the output columns and expressions of the automatic summary table.

16. The article of manufacture of claim 15 , further comprising determining a subpredicate combined selectivity estimate of the unapplied eligible predicates using column distribution statistics of the automatic summary table.

17. The article of manufacture of claim 16 , wherein a cardinality ratio comprises a ratio of a cardinality of the automatic summary table to a product of cardinalities of base tables referenced in the automatic summary table and the query.

18. The article of manufacture of claim 17 , wherein the selectivity estimate comprises a product of the subpredicate combined selectivity estimate and the cardinality ratio.

Assignments (3)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 29, 2020
From: INTERNATIONAL BUSINESS MACHINES CORPORATION
To: SNOWFLAKE INC.
Reel/Frame 052527/0216 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 1, 2020
From: RED HAT, INC.
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 052280/0079 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 12, 2017
From: INTERNATIONAL BUSINESS MACHINES CORPORATION
To: RED HAT, INC.
Reel/Frame 040952/0270 →