IP Library › Granted Patent US 11,138,165
Granted Patent B2
US 11,138,165 · App. 16/375,008 · Granted Oct 5, 2021

Cost heuristic for filter evaluation

Inventors: Oliver Horn (Nussloch, DE); Marius Eich (Neustadt, DE)
Assignee: SAP SE
G06F16/217G06F16/2291G06F16/24545G06F16/24549
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 11,138,165
App. No.
16/375,008
Granted
Oct 5, 2021
Kind
B2
Abstract

A method, a system, and a computer program product for executing a query. A query plan for execution of a query is generated. The query requires access to at least one table stored in a database system. The query includes one or more filter predicates. A filter predicate in the one or more filter predicates is selected. For the selected filter predicate, a plurality of cost function values associated executing a filter evaluation of the selected filter predicate are determined. Filter evaluation of the selected predicate is executed in accordance with at least one determined cost function value in the plurality of cost function values.

Claims (32)

1. A computer-implemented method, comprising:

generating, using a query optimizer component, a query plan for execution of a query, the query requiring access to at least one table stored in a database system, the query including one or more filter predicates for filtering data stored in the at least one table, a query plan compiler component compiling the generated query plan, the generated query plan including at least one of a pre-compiled code selected for at least one operation of the query and a just-in-time code generated for execution of at least one operation of the query, the query optimizer component selecting at least one execution engine configured to support the database system for execution of the query on the database system;

selecting a filter predicate in the one or more filter predicates;

determining, for the selected filter predicate, a plurality of cost function values associated with executing a filter evaluation of the selected filter predicate; and

executing, using the selected execution engine, the filter evaluation of the selected predicate in accordance with at least one determined cost function value in the plurality of cost function values, the at least one determined cost function value includes a cost function value of a branch misprediction during execution of the query determined using at least one of a row count of the at least one table and a selectivity of the filter predicate.

2. The method according to claim 1 , wherein the executing the filter evaluation further comprises executing the filter evaluation of the selected predicate in accordance with the at least one determined cost function value and at least one previous result of the filter evaluation.

3. The method according to claim 1 , wherein the plurality of cost function values are determined using at least one of the following: a dictionary scan of the at least one table, a data vector scan of the at least one table, a data vector lookup of the at least one table, an index lookup of the at least one table, a dictionary lookup of the at least one table, and any combination thereof.

4. The method according to claim 3 , wherein the plurality of cost function values are determined using at least one of the following combinations: the dictionary scan and the data vector scan, the dictionary scan and the data vector lookup, the dictionary scan and the index lookup, and the data vector lookup and the dictionary lookup.

5. The method according to claim 1 , wherein the query is executed by a database execution engine and the query is received from an application separate from the database execution engine.

6. The method according to claim 5 , wherein the query is executed in accordance with the query plan optimized by the database execution engine.

7. A system comprising:

at least one programmable processor; and

a non-transitory machine-readable medium storing instructions that, when executed by the at least one programmable processor, cause the at least one programmable processor to perform operations comprising:

generating, using a query optimizer component, a query plan for execution of a query, the query requiring access to at least one table stored in a database system, the query including one or more filter predicates for filtering data stored in the at least one table, a query plan compiler component compiling the generated query plan, the generated query plan including at least one of a pre-compiled code selected for at least one operation of the query and a just-in-time code generated for execution of at least one operation of the query, the query optimizer component selecting at least one execution engine configured to support the database system for execution of the query on the database system;

selecting a filter predicate in the one or more filter predicates;

determining, for the selected filter predicate, a plurality of cost function values associated with executing a filter evaluation of the selected filter predicate; and

executing, using the selected execution engine, the filter evaluation of the selected predicate in accordance with at least one determined cost function value in the plurality of cost function values, the at least one determined cost function value includes a cost function value of a branch misprediction during execution of the query determined using at least one of a row count of the at least one table and a selectivity of the filter predicate.

8. The system according to claim 7 , wherein the executing the filter evaluation further comprises executing the filter evaluation of the selected predicate in accordance with the at least one determined cost function value and at least one previous result of the filter evaluation.

9. The system according to claim 7 , wherein the plurality of cost function values are determined using at least one of the following: a dictionary scan of the at least one table, a data vector scan of the at least one table, a data vector lookup of the at least one table, an index lookup of the at least one table, a dictionary lookup of the at least one table, and any combination thereof.

10. The system according to claim 9 , wherein the plurality of cost function values are determined using at least one of the following combinations: the dictionary scan and the data vector scan, the dictionary scan and the data vector lookup, the dictionary scan and the index lookup, and the data vector lookup and the dictionary lookup.

11. The system according to claim 7 , wherein the query is executed by a database execution engine and the query is received from an application separate from the database execution engine.

12. The system according to claim 11 , wherein the query is executed in accordance with the query plan optimized by the database execution engine.

13. A computer program product comprising a non-transitory machine-readable medium storing instructions that, when executed by at least one programmable processor, cause the at least one programmable processor to perform operations comprising:

generating, using a query optimizer component, a query plan for execution of a query, the query requiring access to at least one table stored in a database system, the query including one or more filter predicates for filtering data stored in the at least one table, a query plan compiler component compiling the generated query plan, the generated query plan including at least one of a pre-compiled code selected for at least one operation of the query and a just-in-time code generated for execution of at least one operation of the query, the query optimizer component selecting at least one execution engine configured to support the database system for execution of the query on the database system;

selecting a filter predicate in the one or more filter predicates;

determining, for the selected filter predicate, a plurality of cost function values associated with executing a filter evaluation of the selected filter predicate; and

executing, using the selected execution engine, the filter evaluation of the selected predicate in accordance with at least one determined cost function value in the plurality of cost function values, the at least one determined cost function value includes a cost function value of a branch misprediction during execution of the query determined using at least one of a row count of the at least one table and a selectivity of the filter predicate.

14. The computer program product according to claim 13 , wherein the executing the filter evaluation further comprises executing the filter evaluation of the selected predicate in accordance with the at least one determined cost function value and at least one previous result of the filter evaluation.

15. The computer program product according to claim 13 , wherein the plurality of cost function values are determined using at least one of the following: a dictionary scan of the at least one table, a data vector scan of the at least one table, a data vector lookup of the at least one table, an index lookup of the at least one table, a dictionary lookup of the at least one table, and any combination thereof.

16. The computer program product according to claim 15 , wherein the plurality of cost function values are determined using at least one of the following combinations: the dictionary scan and the data vector scan, the dictionary scan and the data vector lookup, the dictionary scan and the index lookup, and the data vector lookup and the dictionary lookup.

17. The computer program product according to claim 13 , wherein the query is executed by a database execution engine and the query is received from an application separate from the database execution engine.

18. The computer program product according to claim 17 , wherein the query is executed in accordance with the query plan optimized by the database execution engine.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 4, 2019
From: HORN, OLIVER; EICH, MARIUS
To: SAP SE
Reel/Frame 048797/0395 →
Continuity (1)
Related Publication 20200320048A1 · Oct 8, 2020