IP Library Granted Patent US 11,954,105
Granted Patent B2
US 11,954,105 · App. 17/420,567 · Granted Apr 9, 2024

Method and system for storing query plans in a cache and method for querying a database system

Inventors: Fang Zheng (Sunnyvale, CA); Zhe Chen (Hangzhou, CN); Ruiping Li (Sunnyvale, CA); Congnan Luo (Sunnyvale, CA); Yu Dong (Sunnyvale, CA); Jie Zhang (Sunnyvale, CA); Li Zhang (Sunnyvale, CA); Ji Jiannan (Hangzhou, CN); Dongcan Cui (Hangzhou, CN); Chaoqun Zhan (Hangzhou, CN)
Assignee: Alibaba Group Holding Limited
G06F16/24552G06F16/24539G06F16/24542
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,954,105
App. No.
17/420,567
Granted
Apr 9, 2024
Kind
B2
Abstract

Methods and computer systems for storing a query plan in a cache are provided. The method can include: determining a use frequency of the query plan; determining a target storage layer for storing the query plan based on the determined use frequency, wherein the cache includes at least two storage layers and each of the storage layers is associated with a compression level of query plans; processing the query plan according to the compression level of the target storage layer; and storing the processed query plan in the target storage layer.

Claims (49)

1. A method for storing a query plan in a cache, comprising:

determining a use frequency of the query plan, the query plan including at least one query operator;

determining a target storage layer for storing the query plan based on the determined use frequency, wherein the cache includes at least two storage layers and each of the storage layers is associated with a compression level of query plans;

processing the query plan according to the compression level of the target storage layer, wherein processing the query plan comprises:

determining a compression level difference between the compression levels of a first storage layer and the target storage layer,

determining a compression change to the at least one query operator of the query plan based on the compression level difference, and

performing the compression change to the at least one query operator of query plan according to a compression algorithm; and

storing the processed query plan in the target storage layer, wherein the query plan is previously stored in the first storage layer different from the target storage layer and is moved from the first storage layer to the target storage layer.

2. The method of claim 1 , wherein the compression level of query plans includes an uncompressed level, a medium compression level, or a high compression level.

3. The method of claim 1 , wherein determining the target storage layer for the query plan based on the use frequency further comprises:

determining compression levels of the at least two storage layers; and

determining, as the target storage layer, a storage layer having a compression level corresponding to the use frequency.

4. The method of claim 1 , wherein the compression change includes compression or decompression of a portion of the at least one query operator.

5. The method of claim 1 , wherein each of the at least one query operator further comprises a query expression, and the compression change further comprises compression or decompression of a portion of the query expression.

6. The method of claim 1 , wherein the determined target storage layer is an external storage, and processing the query plan according to the compression level of the storage layer further comprises:

compressing all of query operators included in the query plan.

7. The method of claim 1 , wherein the at least two storage layers includes a third storage layer and a second storage layer, the second storage layer is associated with higher compression level than the third storage layer, and query plans stored in the second storage layer are associated with lower use frequencies than query plans stored in the third storage layer.

8. The method of claim 1 , wherein a counter is associated with the query plan, the counter counting a number of times the query plan is accessed to generate query results.

9. A computer system for storing a query plan, comprising:

a cache including at least two storage layers and each of the storage layers is associated with a compression level for query plans;

a memory storing a set of instructions; and

at least one processor, configured to execute the set of instructions to cause the computer system to perform:

determining a use frequency of the query plan, the query plan including at least one query operator;

determining a target storage layer for storing the query plan based on the determined use frequency, wherein the cache includes at least two storage layers and each of the storage layers is associated with a compression level of query plans;

processing the query plan according to the compression level of the target storage layer, wherein processing the query plan comprises:

determining a compression level difference between the compression levels of a first storage layer and the target storage layer,

determining a compression change to the at least one query operator of the query plan based on the compression level difference, and

performing the compression change to the at least one query operator of query plan according to a compression algorithm; and

storing the processed query plan in the target storage layer, wherein the query plan is previously stored in the first storage layer different from the target storage layer and is moved from the first storage layer to the target storage layer.

10. The computer system of claim 9 , wherein the at least one processor is configured to execute the set of instructions to cause the computer system to further perform:

determining compression levels of the at least two storage layers; and

determining, as the target storage layer, a storage layer having a compression level corresponding to the use frequency.

11. A method of querying a database system, comprising:

receiving a user query;

retrieving a query plan corresponding to the user query from a target storage layer of a cache, the query plan including at least one query operator; and

transmitting the retrieved query plan for execution by the database system, wherein the cache includes at least two storage layers for storing query plans and each of the storage layers is associated with a compression level of query plans, wherein the query plan is previously stored in a first storage layer different from the target storage layer and is moved from the first storage layer to the target storage layer, and wherein the query plan is processed by:

determining a compression level difference between compression levels of the first storage layer and the target storage layer;

determining a compression change to the at least one query operator of the query plan based on the compression level difference; and

performing the compression change to the at least one query operator of query plan according to a compression algorithm.

12. The method of claim 11 , wherein retrieving the query plan corresponding to the user query from the cache further comprises:

retrieving the query plan through the at least two storage layers sequentially; or

retrieving the query plan through the at least two storage layers using multiple threads.

13. The method of claim 12 , wherein retrieving the query plan through the at least two storage layers sequentially further comprises:

sequentially searching for the query plan corresponding to the user query in a first storage layer and a second storage layer, wherein

the first storage layer stores a first query plan having a first use frequency and the second storage layer stores a second query plan having a second use frequency, and the first use frequency is greater than the second use frequency.

14. The method of claim 11 , wherein the query plan is stored in the cache in association with a reference key.

15. The method of claim 14 , wherein retrieving the query plan corresponding to the user query from the cache:

generating a key by parameterizing the received user query; and

retrieving the query plan associated with the reference key matching the generated key.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 29, 2026
From: ALIBABA GROUP HOLDING LIMITED
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075499/0384 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 22, 2021
From: ZHENG, FANG; CHEN, ZHE; LI, RUIPING; LUO, CONGNAN; DONG, YU; ZHANG, JIE; ZHANG, LI; JIANNAN, JI; CUI, DONGCAN; ZHAN, CHAOQUN
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 057873/0831 →
Continuity (1)
Related Publication 20220114179A1 · Apr 14, 2022